Er Atul Gangwar

Er Atul Gangwar

  • NA
  • 34
  • 735

gridview with checked unchecked checkbox

Apr 17 2019 3:00 PM
$(document).ready(function () {
$("#<%=GridView1.ClientID%> input[id*='CheckBox_Header']:checkbox").click(function () {
if ($("#<%=GridView1.ClientID%>input[id*='CheckBox_Header']:checkbox").prop('checked') == "true")
$("#<%=GridView1.ClientID%> input[id*='CheckBox_row']:checkbox").prop('checked', false);
else
$("#<%=GridView1.ClientID%> input[id*='CheckBox_row']:checkbox").prop('checked', true);
});
 
within gridview  not working properly
 
<asp:TemplateField>
<HeaderTemplate>
<asp:CheckBox ID="CheckBox_Header" runat="server" />
</HeaderTemplate>
<ItemTemplate>
<asp:CheckBox ID="CheckBox_row" runat="server" />
</ItemTemplate>
</asp:TemplateField>
 on first click checked all box but if header checkbox is unchecked nothing happens. please help.
Thank You... 

Answers (4)