Checkboxes placed inside gridview:
<asp:TemplateField>
<HeaderTemplate>
<asp:CheckBox id="chkSelectAll" runat="server" />
</HeaderTemplate>
<ItemTemplate>
<asp:CheckBox ID="chkSelect" runat="server" />
</ItemTemplate>
</asp:TemplateField>
The JQuery method for selecting all checkboxes :
<script type="text/javascript">
function SelectAllCheckboxes(chk) {
$('#<%=GrdRequestList.ClientID %>').find("input:checkbox").each(function () {
if (this
!= chk) {
this.checked
= chk.checked;
}
});
}
</script>
Then change your checkboxes as following :
<asp:TemplateField>
<HeaderTemplate>
<asp:CheckBox id="chkSelectAll"
runat="server"
onclick="javascript:SelectAllCheckboxes(this);"
/>
</HeaderTemplate>
<ItemTemplate>
<asp:CheckBox ID="chkSelect"
runat="server"
/>
</ItemTemplate
</asp:TemplateField>
Regards,
Prajanuranjan..
No comments:
Post a Comment