Hi Everyone,
Can someone help me enable paging on my gridview. I have a grid view that is being populated by a click event and a parameter being passed through in a text box. I am not sure how to get the next page to populate the data from the click and text box event???
Thanks,
Joe
Loading

Ghaffar Abdul21 reputationPosted Dec 1, 2008, 8:38 PM EST
Hi,
Well in the design windwo of ur .aspx page in visual studio select the gridview control. then right click on that gv and go to properties and then see the section paging. Just allow pagging to set the paging behaviour of the gridview control.
Regards
Joe Alegre10 reputationPosted Dec 2, 2008, 8:05 AM EST
Pankaj Gupta66 reputationPosted Dec 3, 2008, 2:27 AM EST
After setting the properties, you have to add the event in the code for handling the paging for the grid view.
Go in the properties and a event "PageIndexChanging".
protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
GridView1.PageIndex = e.NewPageIndex;
// And also bind the data with grid again.
}
Rajendra Deopura139 reputationPosted Dec 3, 2008, 3:49 AM EST
Dear
Go to the source view of your aspx page, set AllowPaging=true. If you are using Data Source Controls like SqldataSource, no need to do any coding but if you are binding GridView with manual code then you need to do coding for PageIndexChanging event.
I have created a small project based on your question. Drop me a mail at [email protected]. I will attach these projects as a attachment and send it to you.
Thanks