Click here to Skip to main content
15,945,119 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
How to display paging numbers in browser as page=2

Dear All,
am working on asp.net Gridview using C#
i have large amount of data in Gridview, i gave paging its working fine.

Now when i click on page 2 in gridview, in browser it must show page=2

Please help this is my code for paging

C#
protected void GVRecords_PageIndexChanging(object sender, GridViewPageEventArgs e)
    {
        GVRecords.PageIndex = e.NewPageIndex;
        GVRecords.DataBind();
    }
Posted
Updated 15-Feb-14 22:25pm
v2

C#
protected void GVRecords_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
    // Get the Page number and display on a Label.
    int newPageNumber = e.NewPageIndex + 1;
    someLabel.Text = "Page=" + newPageNumber.ToString();

    GVRecords.PageIndex = e.NewPageIndex;
    GVRecords.DataBind();
}
 
Share this answer
 
Comments
Member239258 16-Feb-14 6:46am    
Sir, how can i view in browser such as
http://www.codeproject.com/script/Answers/List.aspx?tab=active&pgnum=2
Please help thanks.
.aspx :
ASP.NET
<asp:gridview id="GVRecords" runat="server" allowpaging="true" xmlns:asp="#unknown">
        ....
        ....
        ....
</asp:gridview>

.aspx.cs :
C#
protected void GVRecords_PageIndexChanging(object sender, GridViewPageEventArgs e)
    {
        GVRecords.PageIndex = e.NewPageIndex;
        GVRecords.DataBind();
    }


-KR
 
Share this answer
 
Comments
Member239258 16-Feb-14 4:41am    
hello sir, i already gave allow paging="true"
But the thing here is i want to show the page number in browser
Please help.
THANKS.
Check my answer. :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900