gridview multiple check box column
<p>Work on asp.net vs05. I have three type of <strong>value Like:IsDesign,IsPrinting,IsInstall</strong> they are  bit type. To represent this bits values on my gridview I use three checkbox  columns, GridView control with three header checkbox and checkbox for each individual record. When you click the header check all checkboxes when the header checkbox is checked it highlights all the rows and checks the checkboxes in all rows, and when unchecked it restores back the original color of the row and unchecks the checkboxes.</p>

<p>To complete this task, want to use the client side script.</p>

<pre><code>&lt;asp:GridView ID="gvSearch" runat="server" AutoGenerateColumns="False" DataKeyNames="JobID" Width="880px" CellPadding="5" ForeColor="#333333" GridLines="None" AllowPaging="True" HorizontalAlign="Center" CellSpacing="1" PageSize="5" ShowFooter="True"  Height="278px" OnPageIndexChanging="gvSearch_PageIndexChanging" OnRowDataBound="gvSearch_RowDataBound"&gt;
   &lt;Columns&gt;
      &lt;asp:CheckBoxField HeaderText="IsDesign" /&gt;
      &lt;asp:CheckBoxField HeaderText="IsPrinting" /&gt;
      &lt;asp:TemplateField HeaderText="IsInstall"&gt;
        &lt;EditItemTemplate&gt;
           &lt;asp:CheckBox ID="ckbIsDelivered" runat="server" Checked='&lt;%# Bind("IsDelivered") %&gt;' Text="IsDelivered" /&gt;
        &lt;/EditItemTemplate&gt;
        &lt;FooterTemplate&gt;
           &lt;asp:Button ID="btnSave" runat="server" OnClick="btnSave_Click" Text="Save" /&gt;
        &lt;/FooterTemplate&gt;
        &lt;ItemTemplate&gt;
           &lt;asp:CheckBox ID="ckbIsDelivered" runat="server" onclick = "Check_Click(this)" Checked='&lt;%# Bind("IsDelivered") %&gt;' /&gt;
        &lt;/ItemTemplate&gt;
        &lt;HeaderTemplate&gt;
            &amp;nbsp;&lt;br /&gt;
            &lt;table border="0" cellpadding="0" cellspacing="0"&gt;
               &lt;tr&gt;
                  &lt;td style="width: 21px"&gt;
                     &lt;input id="chkAll" name="chkAll" onclick = "checkAll(this);" type="checkbox" /&gt;
                  &lt;/td&gt;
                  &lt;td style="width: 70px"&gt;
                     &lt;asp:Label ID="Label14" runat="server" Text="IsDelivered" /&gt;
                  &lt;/td&gt;
               &lt;/tr&gt;
            &lt;/table&gt;
        &lt;/HeaderTemplate&gt;
      &lt;/asp:TemplateField&gt;
      &lt;asp:TemplateField HeaderText="JobID " SortExpression="JobID"&gt;
         &lt;EditItemTemplate&gt;
             &lt;asp:Label ID="Label1" runat="server" Text='&lt;%# Eval("JobID") %&gt;' /&gt;
         &lt;/EditItemTemplate&gt;
         &lt;ItemTemplate&gt;
             &lt;asp:Label ID="lblJobID" runat="server" Text='&lt;%# Bind("JobID") %&gt;' /&gt;
         &lt;/ItemTemplate&gt;
      &lt;/asp:TemplateField&gt;
      &lt;asp:BoundField DataField="JobNo" HeaderText="JobNo " SortExpression="JobNo" /&gt;
      &lt;asp:BoundField DataField="ClientName" HeaderText="ClientName " SortExpression="ClientName" /&gt;
      &lt;asp:BoundField DataField="MediaName" HeaderText="MediaName " SortExpression="MediaName" /&gt;
      &lt;asp:BoundField DataField="BrandName" HeaderText="BrandName " SortExpression="BrandName" /&gt;
      &lt;asp:BoundField DataField="JobTypeDesc" HeaderText="JobTypeDesc " SortExpression="JobTypeDesc" /&gt;
      &lt;asp:BoundField DataField="JobDesc" HeaderText="JobDesc " SortExpression="JobDesc" /&gt;
      &lt;asp:BoundField DataField="OutletNameEnglish" HeaderText="OutletNameEnglish " SortExpression="OutletNameEnglish" /&gt;
      &lt;asp:BoundField DataField="OutletAddressEnglish" HeaderText="OutletAddressEnglish " SortExpression="OutletAddressEnglish" /&gt;
      &lt;asp:BoundField DataField="Length" HeaderText="Length " SortExpression="Length" /&gt;
      &lt;asp:BoundField DataField="Height" HeaderText="Height " SortExpression="Height" /&gt;
      &lt;asp:BoundField DataField="Sft" HeaderText="Sft " SortExpression="Sft" /&gt;
      &lt;asp:BoundField DataField="DeliveryTargetDate" HeaderText="DeliveryTargetDate " SortExpression="DeliveryTargetDate" DataFormatString="{0:dd MMM yyyy}" /&gt;
      &lt;asp:BoundField DataField="JobPriorityID" HeaderText="JobPriorityID " SortExpression="JobPriorityID" /&gt;
      &lt;asp:BoundField DataField="Remarks" HeaderText="Remarks " SortExpression="Remarks" /&gt;
      &lt;asp:CheckBoxField DataField="Status" HeaderText="Status " SortExpression="Status" /&gt;
      &lt;asp:CheckBoxField DataField="IsActive" HeaderText="IsActive " SortExpression="IsActive" /&gt;
   &lt;/Columns&gt;
   &lt;AlternatingRowStyle BackColor="White" ForeColor="#284775" /&gt;
   &lt;RowStyle BackColor="#F7F6F3" ForeColor="#333333" Height="50px" /&gt;
   &lt;FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" Height="20px" /&gt;
   &lt;PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" /&gt;
   &lt;SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" /&gt;
   &lt;HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" HorizontalAlign="Center"  BorderWidth="1px" Height="20px" /&gt;
   &lt;EditRowStyle BackColor="#999999" Height="40px" Width="100px" /&gt;
</code></pre>

<p></p>
