среда, 6 апреля 2011 г.

Paging In Gridview Using PagerTemplate


01<asp:GridView ID="gv" Runat="Server" DataSourceID="SqlDataSource1" AutoGenerateColumns="false"
02BorderColor="#000080"
03BorderWidth="2px"
04HorizontalAlign="Center"
05Width="90%" AllowPaging=true BackColor=Gray  PagerSettings-Position=TopAndBottom  >
06<Columns>
07<asp:BoundField HeaderText="localityID" DataField="localityid"  />
08<asp:BoundField HeaderText="localityName" DataField="localityname" />
09 
10Columns>
11 
12<PagerTemplate>
13<asp:LinkButton CommandName="Page" CommandArgument="First"
14ID="LinkButton1" runat="server" Style="color: white">
15« Firstasp:LinkButton>
16<asp:LinkButton CommandName="Page" CommandArgument="Prev"
17ID="LinkButton2" runat="server" Style="color: white">
18Prev
19[Records <%= gv.PageIndex * gv.PageSize%>-<%= gv.PageIndex * gv.PageSize + gv.PageSize - 1%>]
20<asp:LinkButton CommandName="Page" CommandArgument="Next"
21ID="LinkButton3" runat="server" Style="color: white">
22Next >asp:LinkButton>
23<asp:LinkButton CommandName="Page" CommandArgument="Last"
24ID="LinkButton4" runat="server" Style="color: white">
25Last »asp:LinkButton>
26PagerTemplate>
27asp:GridView>
28<asp:SqlDataSource ID="SqlDataSource1" runat="server" SelectCommand="SELECT * FROM locality"
29ConnectionString="<%$ ConnectionStrings:ConnectionString %>" />

Комментариев нет: