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
Rajendra DeopuraPosted Dec 3, 2008, 8:49 AM
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
Pankaj GuptaPosted Dec 3, 2008, 7:27 AM
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.
}
Joe AlegrePosted Dec 2, 2008, 1:05 PM
Ghaffar AbdulPosted Dec 2, 2008, 1:38 AM
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