<%@ Page Language="C#" AutoEventWireup="true" CodeFile="CustomDetailsView.aspx.cs"
   Inherits="CustomDetailsView" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
   <title>Niestandardowa kontrolka DetailsView</title>
   <link href="chapterStyles.css" type="text/css" rel="stylesheet" />
   <style type="text/css">

	</style>
</head>
<body>
   <form id="form1" runat="server">
      <div id="container">
         <h1>
            Niestandardowa kontrolka DetailsView</h1>
         <p>
            W przykładzie pokazano, jak dostosować kontrolkę <code>DetailsView</code> 
            używając elementu <code>Fields</code>.
         </p>
         <asp:DetailsView ID="detvBooks" runat="server" DataSourceID="dsBooks" AutoGenerateRows="false" DataKeyNames="ISBN">
            <Fields>
               <asp:BoundField DataField="ISBN" HeaderText="Isbn:" ReadOnly="True">
                  <ItemStyle CssClass="fieldData" />
               </asp:BoundField>
               <asp:ImageField HeaderText="Okładka:" DataImageUrlField="Isbn" DataImageUrlFormatString="images/{0}.gif"
                  DataAlternateTextField="Title" DataAlternateTextFormatString="Okładka {0}"
                  ReadOnly="True" />
               <asp:BoundField DataField="Title" HeaderText="Tytuł:">
                  <ItemStyle CssClass="fieldData" />
                  <HeaderStyle CssClass="fieldLabel" />
               </asp:BoundField>
               <asp:BoundField DataField="PublisherName" HeaderText="Wydawca:" AccessibleHeaderText="xyz">
                  <ItemStyle CssClass="fieldData" />
                  <HeaderStyle CssClass="fieldLabel" />
               </asp:BoundField>
               <asp:BoundField DataField="YearPublished" HeaderText="Rok:">
                  <ItemStyle CssClass="fieldData" />
                  <HeaderStyle CssClass="fieldLabel" />
               </asp:BoundField>
               <asp:BoundField DataField="BriefDescription" HeaderText="Opis:">
                  <ItemStyle CssClass="fieldData" />
                  <HeaderStyle CssClass="fieldLabel" />
               </asp:BoundField>
               <asp:CommandField EditText="Edycja książki" ShowEditButton="True" />
            </Fields>
            <RowStyle VerticalAlign="Top" BackColor="#EFF3FB" />
            <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
            <CommandRowStyle BackColor="#D1DDF1" Font-Bold="True" />
            <EditRowStyle BackColor="#2461BF" />
            <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
            <FieldHeaderStyle BackColor="#DEE8F5" Font-Bold="True" />
            <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
            <AlternatingRowStyle BackColor="White" />
         </asp:DetailsView>
      </div>
      <asp:SqlDataSource ID="dsBooks" runat="server" ProviderName="System.Data.OleDb" ConnectionString="<%$ ConnectionStrings:Books %>"
         SelectCommand="SELECT ISBN,Title,PublisherName,Books.PublisherId,YearPublished,BriefDescription FROM Books INNER JOIN Publishers ON Books.PublisherId=Publishers.PublisherId"
         UpdateCommand="UPDATE Books SET Title=@Title,PublisherId=@PublisherId,YearPublished=@YearPublished,BriefDescription=@BriefDescription WHERE ISBN=@ISBN">
      </asp:SqlDataSource>
   </form>
</body>
</html>
