Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    ljv
    ljv is offline
    New to the CF scene
    Join Date
    Dec 2006
    Posts
    1
    Thanks
    0
    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

    regards

  • #2
    Senior Coder nikkiH's Avatar
    Join Date
    Jun 2005
    Location
    Near Chicago, IL, USA
    Posts
    1,973
    Thanks
    1
    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/


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •