Check all checkboxes as the header checkbox is checked
-
Hi All, How all the checkboxes get checked as the header checkbox is checked or selected
-
Hi All, How all the checkboxes get checked as the header checkbox is checked or selected
you can create controll array. And map each array item to each check box. so u need to iterate through that array to check or uncheck..
If U Have Interest, U Can... Sherin Iranimose
-
Hi All, How all the checkboxes get checked as the header checkbox is checked or selected
Hi, Do as follows. Please let me know if you face any issues. 1. First, code in the aspx page, html view as follows: <asp:datagrid id="dgAnalDelete" runat="server"><Columns> <asp:BoundColumn HeaderText="Sl.No"></asp:BoundColumn> <asp:TemplateColumn HeaderText="Visible"> <HeaderTemplate> <input type="checkbox" id="checkAll" onclick="CheckAll(this);" runat="server" NAME="checkAll">(Un)Select All </HeaderTemplate> <ItemTemplate> <asp:Checkbox runat="server" ID="chkID" Checked='<%# GetChecked(DataBinder.Eval(Container, "DataItem.Selected").ToString()) %>'> </asp:Checkbox> </ItemTemplate> </Columns> </asp:datagrid> 2. Write the javascript function as follows: function CheckAll( checkAllBox ) { var frm = document.Form1 ; var actVar = checkAllBox.checked ; for(i=0;i< frm.elements.length;i++) { e=frm.elements[i]; if ( e.type=='checkbox' && e.name.indexOf("chkID") != -1 ) e.checked= actVar ; } } Happy Coding!! ;-)
Meeram395