Click here to Skip to main content
15,868,306 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Dear All,

I am using the gridview with the page index facility. so now i want to display the current page index number on the label.

so, how can i do this for the print the current page index in to the label of asp.net.

So, please help me .


Thanks and Regards

Mitesh
Posted

C#
label.Text = (GridView.PageIndex +1).ToString();
 
Share this answer
 
Hi,
You can set that inside the PageIndexChanging event of the gridview.

C#
protected void dgv_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
dgv.PageIndex = e.NewPageIndex;
dgv.DataBind();
lblPage.Text = e.NewPageIndex.ToString();
}


Best Regards
Muthuraja
 
Share this 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