title: ASP.NET Binding integer to CheckBox's Checked field
body: <p>I have a following ListView item template, in which I am trying to bind integer value to <code>Checked</code> property of CheckBox.</p>
  
  <p><code>IsUploaded</code> value contains only 0 and 1...</p>
  
  <pre><code>&lt;asp:ListView ID="trustListView" runat="server"&gt;
      &lt;ItemTemplate&gt;
          &lt;asp:CheckBox ID="isUploadedCheckBox" runat="server"
              Checked='&lt;%# Bind("IsUploaded") %&gt;' /&gt;
      &lt;/ItemTemplate&gt;
  &lt;/asp:ListView&gt;
  </code></pre>
  
  <p>But ASP.NET complains that </p>
  
  <blockquote>
    <p>Exception Details: System.InvalidCastException: Sepcified cast is not valid</p>
  </blockquote>
  
  <p>Even though following code using <code>DataBinder.Eval()</code> works,
  <br />I need to have a 2-way binding, thus need to use <code>Bind()</code>.</p>
  
  <pre><code>&lt;asp:CheckBox ID="isUploadedCheckBox2" runat="server"
      Checked='&lt;%# Convert.ToBoolean(
          DataBinder.Eval(Container.DataItem, "IsUploaded"))) %&gt;' /&gt;
  </code></pre>
  
  <p><strong>How can I convert 0's and 1's to boolean using <code>Bind()</code></strong>?</p>
  
  <hr>
  
  <p><strong>[ANSWER]</strong> 
  I have extended auto-generated type through partial class by adding a new property mentioned in the <a href="https://stackoverflow.com/questions/1561382/asp-net-binding-integer-to-checkboxs-checked-field/1561480#1561480">answer by Justin</a></p>