View Full Version : Auto Paging In DataGrid with Templates

12-28-2006, 05:48 AM
I have a Datagrid With templates used for edit, delete and update purpose.
I have applied auto paging in the data grid. the problem i am facing is that when i go to a page greater than 1 and then delete records from there constantly, the browser comes to the previous page and at that point it gives error of the page index not valid. I think that the page index is not being refreshed when the control is tranferred from one page to another.

waiting for ur reply


12-28-2006, 03:27 PM
If you're using .net 2.0, use the GridView instead of DataGrid. It will take care of most of that for you.

Otherwise, the error is in your code. With DataGrid, there's a lot of stuff you need to take care of yourself ("boilerplate code") every time you use one. You'd need to post most of your relevant code for us to tell what you forgot or are doing wrong. Start with your page load and delete handlers (and all dependent functions or methods you wrote) and we can go from there. Most likely you're forgetting to do something in the delete handler, like rebinding.

You did implement the paging handler, right? (page index changed event) Just turning it on won't make it work, unlike the GridView. And if you're not careful, your page load code can conflict with other code, since page load always fires.