Asp.Net Gridview CheckAll CheckBoxes From Javascript

GridView Header CheckALl Cehbox From Javascript
 
 
   <Columns>
       <asp:TemplateField HeaderText=”Select”>
            <HeaderTemplate >
              <input id=”chkAll” onclick=”javascript:SelectAllCheckboxes(this);” runat=”server”   type=”checkbox” visible=”false” />
                    </HeaderTemplate>
                         <ItemTemplate>
                             <asp:CheckBox ID=”chkSelect” runat=”server” />
                         </ItemTemplate>
        </asp:TemplateField>
                           
        <asp:BoundField DataField=”EMP_ID” HeaderText=”Employee Id” >
  
  </Columns>
  
  Javascript For ChekBox to Select ALL
  
    <script language=”javascript” type=”text/javascript”>

    function SelectAllCheckboxes(spanChk){

      // Added as ASPX uses SPAN for checkbox

      var oItem = spanChk.children;
      var theBox= (spanChk.type==”checkbox”) ?
     spanChk : spanChk.children.item[0];
      xState=theBox.checked;
      elm=theBox.form.elements;

      for(i=0;i<elm.length;i++)
     if(elm[i].type==”checkbox” &&
        elm[i].id!=theBox.id)
     {
       //elm[i].click();

       if(elm[i].checked!=xState)
      elm[i].click();
       //elm[i].checked=xState;

     }
    }
   </script>

Asp.Net GridView Confirm Message From Javascript

From Below Code You Can put Confination Message in GridView From Javascript return Confim
  
<asp:ImageButton  CssClass=”Delete”  BorderWidth=”0″ runat=”server”
   ID=”btnEditrecord” CommandName=”Delete” CommandArgument='<%# Eval(“EMP_ID”) %>’
   AlternateText=”Delete” CausesValidation=”False”  OnClientClick=”return confirm(‘Are You Sure To Delete Record  ?’)”></asp:ImageButton>