title: How to get CheckBox working with ItemTemplate
body: <p>I need to get CheckBox working with my GridView, so it displays whether the checkbox read from the database is checked or not.</p>
  
  <p>SArchive - the checkbox field - is a Bit field in the database.</p>
  
  <p>IF DBNull I want no tick in the CheckBox.  Unfortunately at the moment it's showing either true or false text next to the checkbox.  When I edit the record that has a true, the check box is not checked, even though it's true in the database.</p>
  
  <p>Screenshot: Not edited</p>
  
  <p><img src="https://i.stack.imgur.com/kksZk.png" alt="enter image description here"></p>
  
  <p>Screenshot: Edited mode</p>
  
  <p><img src="https://i.stack.imgur.com/rNdQu.png" alt="enter image description here"></p>
  
  <p>code:</p>
  
  <pre><code>&lt;ItemTemplate&gt;
      &lt;asp:CheckBox ID="Label7" runat="server" Text='&lt;%# Eval("SArchive") %&gt;' &gt;
      &lt;/asp:CheckBox&gt;
  &lt;/ItemTemplate&gt;
  &lt;EditItemTemplate&gt;
      &lt;asp:CheckBox ID="cb1" runat="server" 
                    Text='&lt;%# Eval("SArchive") == DBNull.Value ? false : Convert.ToBoolean(Eval("SArchive"))%&gt;'&gt;
      &lt;/asp:CheckBox&gt;
  &lt;/EditItemTemplate&gt;
  </code></pre>
  
  <p>Any help please, thanks.
  Tea.</p>