asp.net checkbox in gridview - checked property is missing
Posted
by
Peter PitLock
on Stack Overflow
See other posts from Stack Overflow
or by Peter PitLock
Published on 2012-09-19T09:34:29Z
Indexed on
2012/09/19
9:37 UTC
Read the original article
Hit count: 228
In this asp.net gridview control, the checked property is always missing. I need to access the checked property via jquery
Gridview source:
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:CheckBox ID="chkSelected" runat="server" class="chkSummarySelection" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
Renders as :
<input type="checkbox" name="ctl00$ContentPlaceHolder1$gv$ctl02$SelectedCheckBox" id="ctl00_ContentPlaceHolder1_gv_ctl02_SelectedCheckBox">
There is no checked property to access. I have tried
$(".chkSummarySelection").click(function () {
var chk;
chk = $(this).prop("checked");
chk = $(this).attr("checked");
chk = $(this).is(":checked");
chk = $(this).attr("value");
chk = $(this).val();
chk = jQuery(this).is(':checked');
});
but nothing is working
© Stack Overflow or respective owner