Wednesday, February 1, 2012

Custom Paging In GridView without objectDataSource c#

Take a gridview as shown below

<asp:GridView ID="GridView2" runat="server" Width="750" AutoGenerateColumns="false" AllowPaging="true" onpageindexchanging="GridView2_PageIndexChanging" >

After <Columns> </Columns> tag write



<PagerTemplate>
                  <asp:LinkButton CommandName="Page" CommandArgument="First" ID="LinkButton1" runat="server" Style="color: Blue">
                  « First</asp:LinkButton>
                  <asp:LinkButton CommandName="Page" CommandArgument="Prev" ID="LinkButton2" runat="server" Style="color: Blue">
                  <asp:LinkButton CommandName="Page" CommandArgument="Next" ID="LinkButton3" runat="server" Style="color: Blue">
                    Next > </asp:LinkButton>
                <asp:LinkButton CommandName="Page" CommandArgument="Last" ID="LinkButton4" runat="server" Style="color: Blue">
                Last » </asp:LinkButton>
                </PagerTemplate>


Thats All you can have your costume paging for gridview

No comments:

Post a Comment