0

I have a page that uses the Telerik RadListView control and a Telerik RadDataPager control. The RadListView control holds checkboxes with each item. The checkboxes have been wired to a click event using jQuery (see below).

$(document).ready(function () {
       //Update the hidden variable with all fieldchoices to be added
        $('#FieldSet1').find("input[type='checkbox']").click(function () {
    //do something

});

});

However, when I click to another page using the RadDataPager, the checkboxes lose their onclick event AND the checked state.

Does anyone have any idea how to keep the checkbox wired to the click event, and also how to keep the checkboxes checked?

Any ideas will be appreciated

Thanks

Akin
  • 137
  • 2
  • 12

2 Answers2

0

I faced the same problem with RadControls year ago and also with Telerik MVC Grid some months ago. What I did was storing each checked id on a global javascript variable (using JSON) and each time the user changed the page just "reset" whatever the user had on that page on the event handler. Hope this helps

pollirrata
  • 5,188
  • 2
  • 32
  • 50
0

to keep your events wired up, try:

$('body').on('click',"#FieldSet1 input[type='checkbox']", function () {
    //do something

});

to store your state take a look at store.js which uses localstorage and supports serialization

Jason Kulatunga
  • 5,814
  • 1
  • 26
  • 50
  • Hey Jason, thanks for the response. The checkboxes didnt stay wired up. I'm still looking into the store.js for the state of the checkboxes...thanks – Akin Jun 15 '12 at 20:06
  • Hey @AkinOkunrinboye, any chance you could share some of the generated html markup? it would make it a bit easier to figure out the jquery selectors you need – Jason Kulatunga Jun 16 '12 at 00:24
  • @AkinOkunrinboye Hey, I've made an edit to add the persistent event handler to the body tag rather than the FieldSet1 id, as I think that may be getting replaced by telerik. It would be a bit easier to help debug this if we had some HTML code – Jason Kulatunga Jun 16 '12 at 19:13