Maintain state of checkboxes across datagrid paging
Hi All,
I have a datagrid with paging turned on for 20 records a page. There is a checkbox on every record. If the user checks the box, and then changes pages and comes back, the checkbox is gone. How can I maintain it?
What I need to happen is, when they are done checking boxes, a button will be pressed and all records that have been checked (regardless of page), will be added to another table.
The user can also filter the grid by clicking on a radio button list, which reloads the grid, so the position of the checked rows would change.
The datakey field is "USERID". When the page or filter changes, can I just loop through the grid and grab the USERID for every checked record, then on PostBack and reloading, compare every USERID on the grid to see if it matches what I've stored somewhere (in an ArrayList in session for example?)? THen check the box? Seems complicated.
I don't know how to solve this. It seems basic enough that someone else must have done this.
Any help is appreciated! Thanks.