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

<!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>Edycja w kontrolce 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>
            Edycja w kontrolce DetailsView</h1>
         <p>
            W przykładzie pokazano, jak edytować dane za pomocą kontrolki <code>DetailsView</code>.
         </p>
<asp:DetailsView ID="detvBooks" runat="server" DataSourceID="dsBooks"
  AllowPaging="true" AutoGenerateRows="false" DataKeyNames="ISBN"
  AutoGenerateEditButton="true" AutoGenerateInsertButton="False">
   <Fields>
      <asp:BoundField DataField="ISBN" HeaderText="Isbn:" ReadOnly="true" InsertVisible="false"  />
      <asp:BoundField DataField="Title" HeaderText="Tytuł:" />
      
      <asp:BoundField DataField="YearPublished" HeaderText="Rok:" />
      <asp:BoundField DataField="BriefDescription" HeaderText="Opis:" />

   </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.SqlClient" ConnectionString="<%$ ConnectionStrings:BookCatalog %>"
         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,YearPublished=@YearPublished,BriefDescription=@BriefDescription WHERE ISBN=@ISBN">
         

      </asp:SqlDataSource>
      
      <asp:SqlDataSource ID="dsPublisher" runat="server"
             ProviderName="System.Data.OleDb" 
             ConnectionString="<%$ ConnectionStrings:Books %>"
             SelectCommand="Select PublisherId,PublisherName From Publishers" /> 
   </form>
</body>
</html>

