質問

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

役に立ちましたか?

解決

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

他のヒント

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

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top