title: CheckBox Gridview Enable and Disable
body: <p>I have a gridview where the checkboxes start off disabled.  I want to enable them when I click the edit button that's also in the gridview.  Here's the markup</p>
  
  <pre><code>&lt;asp:GridView ID="grd_Bookcode" runat="server" DataSourceID="sqldatasource1" 
  autogeneratecolumns="False" onrowcommand="grd_Bookcode_RowCommand1" 
  onrowdatabound="grd_Bookcode_RowDataBound"&gt;
  &lt;Columns&gt;
      &lt;asp:BoundField DataField="BookCode" HeaderText="Book Code"/&gt;
      &lt;asp:BoundField DataField="mag_name" HeaderText="Name"/&gt;
      &lt;asp:BoundField DataField="display_date" HeaderText="Display Date"/&gt;
     &lt;asp:TemplateField HeaderText = "PC"&gt;
          &lt;ItemTemplate&gt;
              &lt;asp:CheckBox ID="CheckBox1" runat="server" Checked='&lt;%# Eval("82_PC").ToString() == "1" ? true:false %&gt;' Enabled="false" /&gt;
          &lt;/ItemTemplate&gt;
       &lt;/asp:TemplateField&gt;
       &lt;asp:TemplateField HeaderText="eReader"&gt;
          &lt;ItemTemplate&gt;
              &lt;asp:CheckBox ID="CheckBox2" runat="server" Checked='&lt;%# Eval("83_eReader").ToString() == "1" ? true:false %&gt;' Enabled="false" /&gt;
          &lt;/ItemTemplate&gt;
      &lt;/asp:TemplateField&gt;
       &lt;asp:TemplateField HeaderText="Tablet"&gt;
          &lt;ItemTemplate&gt;
              &lt;asp:CheckBox ID="CheckBox3" runat="server" Checked='&lt;%# Eval("84_Tablet").ToString() == "1" ? true:false %&gt;' Enabled="false"/&gt;
          &lt;/ItemTemplate&gt;
      &lt;/asp:TemplateField&gt;
       &lt;asp:TemplateField HeaderText="Mobile"&gt;
          &lt;ItemTemplate&gt;
              &lt;asp:CheckBox ID="CheckBox4" runat="server" Checked='&lt;%# Eval("85_Mobile").ToString() == "1" ? true:false %&gt;' Enabled="false" /&gt;
          &lt;/ItemTemplate&gt;
      &lt;/asp:TemplateField&gt;
       &lt;asp:TemplateField HeaderText="None"&gt;
          &lt;ItemTemplate&gt;
              &lt;asp:CheckBox ID="CheckBox5" runat="server" Checked='&lt;%# Eval("86_None").ToString() == "1" ? true:false %&gt;' Enabled="false" /&gt;
          &lt;/ItemTemplate&gt;
     &lt;/asp:TemplateField&gt;
      &lt;asp:CommandField ShowEditButton="True" /&gt;
  &lt;/Columns&gt;
  </code></pre>
  
  <p></p>
  
  <p>And then here's the code that I'm trying to use.  Basically, when I hit the edit button, I want the checkboxes themselves to be enabled.  For whatever reason, the checkbox isn't enabled at all when the page loads back up.  I just started off trying to enable "Checkbox1" after the edit button is clicked but eventually want to enable all 5 checkboxes.  </p>
  
  <pre><code> protected void grd_Bookcode_RowCommand1(object sender, GridViewCommandEventArgs e)
      {
          if (e.CommandName == "Edit")
          {
              int index = Convert.ToInt32(e.CommandArgument);
  
              GridViewRow row = grd_Bookcode.Rows[index];
  
              CheckBox chk = (CheckBox)row.FindControl("CheckBox1");
              chk.Enabled = true;
  
  
          }
      }
  </code></pre>