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

<!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>Zagnieżdzone kontrolki GridView</title>
   <link href="chapterStyles.css" type="text/css" rel="stylesheet" />
   <style type="text/css">
      .box {
         margin: 1em 0; border: solid 1pt silver; padding: 0.5em;
      }
      
      .bookList {  }
      .bookListRow { background-color: #F7F7DE; }
      .bookListSelected { background-color:#CE5D5A; font-weight: bold; color: White; }
      .bookListPager { background-color:#F7F7DE; font-weight: bold; color: Black; }
      .bookListHeader { background-color:#6B696B; font-weight: bold; color: White; }
      .bookListAlt { background-color: white; }
      
      .publisherList { border: solid 1pt #DEDFDE; }
      .publisherRow { background-color: #F7F7DE; }
      .publisherHeader { background-color:#6B696B; font-weight: bold; color: White; }
      .publisherAlt { background-color: white; }      
   </style>
</head>
<body>
   <form id="form1" runat="server">
      <div id="container">
         <h1>Zagnieżdzone kontrolki GridView</h1>
         <p>
         W przykładzie pokazano, jak zagnieździć jedną kontrolkę <code>GridView</code> w innej
         kontrolce <code>GridView</code>.
         </p>
         <div class="box">
            <asp:GridView ID="grdPublishers" runat="server" DataSourceID="dsPublisher"
               DataKeyNames="PublisherId"
               AutoGenerateColumns="False" 
               Width="600" CssClass="publisherList"
               CellPadding="4" GridLines="Vertical" 
               OnRowDataBound="grdPublishers_RowDataBound" >

               <Columns>            
                  <asp:BoundField DataField="PublisherName" HeaderText="Wydawca" ItemStyle-VerticalAlign="top"/>    
                  <asp:TemplateField>
                     <ItemTemplate>
                     <asp:GridView ID="grdBookList" runat="server" 
                        AutoGenerateColumns="False" 
                        ShowHeader="false" CssClass="bookList"
                        CellPadding="4" GridLines="None"  >

                        <Columns>         
                           <asp:BoundField DataField="Title" />           
                        </Columns>
                        <RowStyle CssClass="bookListRow" />
                     </asp:GridView>                       </ItemTemplate>
                   </asp:TemplateField>     
               </Columns>
               <RowStyle CssClass="publisherRow" />
               <HeaderStyle CssClass="publisherHeader" />
               <AlternatingRowStyle CssClass="publisherAlt" />
            </asp:GridView>  
                     

         </div> 

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