title: Asp.Net Toggle checked property of a Data Bound checkbox
body: <p>I have a GridView control that has one column of checkboxes set up like this:</p>
  
  <pre><code>&lt;asp:TemplateField&gt;
     &lt;ItemTemplate&gt;
          &lt;asp:CheckBox ID="RowCheckBox" runat="server" Enabled="false" Checked='&lt;%# (bool)DataBinder.Eval(Container.DataItem ,"Associated") %&gt;'/&gt;
     &lt;/ItemTemplate&gt;
  &lt;/asp:TemplateField&gt;
  </code></pre>
  
  <p>Then when the user clicks an Edit button I run a script that enables all the checkboxes (which works fine), and then when the user then clicks on a checkbox the tick is appearing or disappearing as it should.</p>
  
  <p>The problem I'm having is that when I try to read the value of the checkbox from the codebehind:</p>
  
  <pre><code>CheckBox checkBox = (CheckBox) row.FindControl("RowCheckBox");
  bool checked = checkBox.Checked;
  </code></pre>
  
  <p>If the value bound to it was <code>true</code> then <code>checked</code> is still <code>true</code>, no matter if it was toggled or not.</p>
  
  <p>Has anyone got any ideas why this is?</p>