This is a creation in Article, where the information may have evolved or changed.
Page:
<PagerTemplate> <table> <tr> <td style= "Text-align:right" > <asp:label ID = "Lblpageindex" runat= "Server" text= "<%# ((GridView) Container.Parent.Parent). PageIndex + 1%> "></asp:Label> page total <asp:label id=" Lblpagecount "runat=" Server "text=" <%# ((Gridv Iew) Container.Parent.Parent). PageCount%> "></asp:Label> page <asp:linkbutton id=" Btnfirst "runat=" Server "causesvalidation=" False " Commandargument= "First" commandname= "page" text= "Home" ></asp:LinkButton> <asp:linkbutton id= "Btnprev" runat= "Server" causesvalidation= "False" commandargument= "Prev" commandname= "page" text= "previous page" ></asp:linkbutt on> <asp:linkbutton id= "btnnext" runat= "Server" causesvalidation= "False" commandargument= "Next" Commandname= "page" text= "next page" ></asp:LinkButton> <asp:linkbutton id= "btnlast" runat= "server" cause svalidation= "False" commandargument= "LAST "commandname=" page "text=" last "></asp:LinkButton> <asp:textbox id=" Txtnewpageindex "Runa t= "Server" text= "<%# ((GridView) Container.Parent.Parent). PageIndex + 1%> "width=" 20px "></asp:TextBox> <asp:linkbutton id=" Btngo "runat=" Server "Causesvalid ation= "False" commandargument= "-1" commandname= "page" text= "GO" ></asp:LinkButton> </td> </t R> </table></PagerTemplate>
Page background:
protected void Pageindexchanging (object sender, Gridviewpageeventargs e) { GridView GVW = (gridview) sender; if (E.newpageindex < 0) { textbox pagenum = (textbox) GVW. Bottompagerrow.findcontrol ("Txtnewpageindex"); int Pa = Int. Parse (pagenum.text); if (Pa <= 0) { GVW. PageIndex = 0; } else { GVW. PageIndex = Pa-1; } } else { GVW. PageIndex = E.newpageindex; } Getbind ();//How you bind the data }