I have several checkboxes inside an UpdatePanel of asp.net
Let’s say, I have 3 checkboxes in that panel. Each time, one checkbox is checked, the previous checked checkbox will be unchecked.
I have tried like this:
<asp:CheckBox ID="CheckBoxExport1" CssClass="checkboxSingle" />
<asp:CheckBox ID="CheckBoxExport1" CssClass="checkboxSingle" />
<asp:CheckBox ID="CheckBoxExport1" CssClass="checkboxSingle" />
In js:
$('.checkboxSingle').live('click', function (e) {
if ($(this).is(':checked')) {
$(".checkboxSingle").attr('checked', false);
$(this).attr('checked', 'checked')
}
});
The click is function but the rest does not.
What’s happening is that on postback the page reloads and the JavaScript doesn’t re-run. I’m posting from my phone so I don’t have the code on me. But google “updatepanel JavaScript postback”. You need to use an asp page event.
I’ll edit this later if you tell me you can’t find it.
Good luck