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

<!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>Sortowanie obiektów w kontrolce 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 { border: solid 1pt #DEDFDE; }
      .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; }
         
   </style>
</head>
<body>
   <form id="form1" runat="server">
      <div id="container">
         <h1>Sortowanie obiektów w kontrolce GridView</h1>
         <p>
         W przykładzie pokazano, jak sortować w kontrolce <code>GridView</code>, 
         w której użyto kontrolki <code>ObjectDataSource</code>.
         </p>
         <asp:GridView ID="grdSample" runat="server" DataSourceID="dsBooks"
           AutoGenerateColumns="False" AllowSorting="true"
           CssClass="bookList"
           CellPadding="4" GridLines="Vertical" >

            <Columns>
               <asp:BoundField DataField="ISBN" HeaderText="Isbn" SortExpression="Isbn"/>                
               <asp:BoundField DataField="Title" HeaderText="Tytuł" SortExpression="Title"/>
               <asp:BoundField DataField="PublisherName" HeaderText="Wydawca" SortExpression="PublisherName"/>
               <asp:BoundField DataField="YearPublished" HeaderText="Rok" SortExpression="YearPublished"/>             
            </Columns>
            <FooterStyle BackColor="#CCCC99" />
            <RowStyle BackColor="#F7F7DE" />
            <SelectedRowStyle BackColor="#CE5D5A" Font-Bold="True" ForeColor="White" />
            <PagerStyle BackColor="#F7F7DE" ForeColor="Black" HorizontalAlign="Right" />
            <HeaderStyle BackColor="#6B696B" Font-Bold="True" ForeColor="White" />
            <AlternatingRowStyle BackColor="White" />
         </asp:GridView>               
      </div>
      <asp:ObjectDataSource ID="dsBooks" runat="server"
         TypeName="BookDA" SelectMethod="GetAll" 
         SortParameterName="sortExpression"
         >
		   
		</asp:ObjectDataSource>   
   </form>
</body>
</html>
