Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
12-28-2006, 04:48 AM #1
- Join Date
- Dec 2006
- Thanked 0 Times in 0 Posts
Auto Paging In DataGrid with Templates
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, 02:27 PM #2
- Join Date
- Jun 2005
- Near Chicago, IL, USA
- Thanked 32 Times in 31 Posts
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.
If this post contains any code, I may or may not have tested it. It's probably just example code, so no getting knickers in a bunch over a typo, OK? If it doesn't have basic error checking in it, such as object detection or checking if objects are null before using them, put that in there. I'm giving examples, not typing up your whole app for you. You run code at your own risk.
Bored? Visit http://www.kaelisspace.com/