jquerytelerikjquery-click-eventraddatapagerradlistview

Checkbox loses its checked state, and click event with Telerik RadDataPager


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


Solution

  • 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