I’m working with Jquery datatables with asp.net repeaters and 90% of everything is working ok. Problem is that I’ve got a column of checkboxes and if I page through the datatable checking some boxes and then submit, I only get the last page of details, it forgets all other pages where checkboxes were checked.
This is covered more or less here:
http://www.datatables.net/forums/discussion/7700/repeater-checkbox-and-paging/p1
However, I’ve no idea how to get that data from an asp.net postback, anyone shed any light on how I’d be able to iterate through the repeater and get all checked boxes?
Thanks.
I would add click handler on each check box that adds/remove id of the selected checkbox in some list (e.g. as a content of some hidden field as a comma separated list or something similar).
When you post form you can read this content from Request[“hiddenFieldName”], split it by comma and save it.
Regarding the lost checkbox values on page change there is not direct solution. My choice would be to bind “page” event handler to datatable – something like this:
function populateCheckboxes will be called on each page change and here you can go through all checkboxes in the table and check whether their value is in the list in the hidden field.
Sorry but there is not easier solution for this, however this is not too complex script either.
Jovan