Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

asp.net maintaining checkbox state while paging

Options
  • 16-06-2010 12:57pm
    #1
    Closed Accounts Posts: 1,759 ✭✭✭


    Hi,

    i have a gridview with a checkbox template in it,
    If I check a checkbox, and say go to page 2, and back to page 1, the checkbox goes back to unchecked.

    Anyone know how to retain the value please ?

    Thanks


Comments

  • Registered Users Posts: 7,468 ✭✭✭Evil Phil


    You can't maintain viewstate between pages so you'll have to store the checkbox state elsewhere (like the session perhaps?) and load it on page_load. Although its been a while so they're might be a better way.


  • Closed Accounts Posts: 1,759 ✭✭✭Dr.Silly


    Evil Phil wrote: »
    You can't maintain viewstate between pages so you'll have to store the checkbox state elsewhere (like the session perhaps?) and load it on page_load. Although its been a while so they're might be a better way.

    Thanks Evil,

    I found this article which worked very well, in case anyone else is looking for it.

    http://aspalliance.com/774_Maintaining_State_of_CheckBoxes_While_Paging_in_a_GridView_Control


Advertisement