title: Setting checked value for Eval(bool)
body: <p>I have a property </p>
  
  <pre><code>public bool AutoRenew
  {
      get;
      set;
  }
  </code></pre>
  
  <p>And in the page: </p>
  
  <pre><code>&lt;input type="checkbox" checked='&lt;%# Eval("AutoRenew") %&gt;' /&gt;
  </code></pre>
  
  <p>but it is always checked, even if the value of the property is <code>false</code>.</p>
  
  <p>I tried the following variations:</p>
  
  <pre><code>&lt;input type="checkbox" checked='&lt;%# Convert.ToBoolean(Eval("AutoRenew")) %&gt;' /&gt;
  &lt;input type="checkbox" checked='&lt;%# Convert.ToBoolean(Eval("AutoRenew")) == true %&gt;' /&gt;
  &lt;input type="checkbox" checked='&lt;%# (Boolean)Eval("AutoRenew") %&gt;' /&gt;
  </code></pre>
  
  <p>but nothing works, it keeps being checked. What should the expression look like?</p>
  
  <p><strong>EDIT:</strong> Here is the problematic part in the page:</p>
  
  <pre><code>...
  &lt;asp:ListView ID="MyListView" runat="server"&gt;
      &lt;LayoutTemplate&gt;
          &lt;table class="ms-listviewtable" style="background-color: White;"&gt;
              &lt;tr class="ms-viewheadertr ms-vhltr"&gt;
                  &lt;th class="ms-vh-icon" scope="col"&gt;
                      &lt;input type="checkbox" /&gt;
                  &lt;/th&gt;
                  &lt;th class="ms-vh2"&gt;
                      &lt;div class="ms-vh-div"&gt;&lt;a&gt;Training Item&lt;/a&gt;&lt;/div&gt;
                  &lt;/th&gt;
                  &lt;th class="ms-vh2"&gt;
                      &lt;div class="ms-vh-div"&gt;&lt;a&gt;Training Task Type&lt;/a&gt;&lt;/div&gt;
                  &lt;/th&gt;
                  &lt;th class="ms-vh2"&gt;
                      &lt;div class="ms-vh-div"&gt;&lt;a&gt;Due Date&lt;/a&gt;&lt;/div&gt;
                  &lt;/th&gt;
                  &lt;th class="ms-vh2"&gt;
                      &lt;div class="ms-vh-div"&gt;&lt;a&gt;Auto-Renew&lt;/a&gt;&lt;/div&gt;
                  &lt;/th&gt;
                  &lt;th class="ms-vh2"&gt;
                      &lt;div class="ms-vh-div"&gt;&lt;a&gt;Training Reason&lt;/a&gt;&lt;/div&gt;
                  &lt;/th&gt;
              &lt;/tr&gt;
              &lt;tr id="itemplaceholder" runat="server"&gt;&lt;/tr&gt;
          &lt;/table&gt;
      &lt;/LayoutTemplate&gt;
      &lt;ItemTemplate&gt;
          &lt;tr class="ms-itmhover"&gt;
              &lt;td class="ms-vb-itmcbx ms-vb-firstCell"&gt;
                  &lt;input type="checkbox" class="s4-itm-cbx" /&gt;
              &lt;/td&gt;
              &lt;td class="ms-vb-title"&gt;
                  &lt;div class="ms-vb itx"&gt;&lt;a&gt;&lt;%# Eval("Title")%&gt;&lt;/a&gt;&lt;/div&gt;
              &lt;/td&gt;
                  &lt;td class="ms-vb2"&gt;
                      &lt;asp:DropDownList ID="TaskTypeDropDownList" runat="server"&gt;
                      &lt;/asp:DropDownList&gt;
                  &lt;/td&gt;
                  &lt;td class="ms-vb2"&gt;&lt;%# Eval("DueDate")%&gt;&lt;/td&gt;
                  &lt;td class="ms-vb2" style="text-align: center;"&gt;
                      &lt;input type="checkbox" checked='&lt;%# Convert.ToBoolean(Eval("AutoRenew")) %&gt;' /&gt;
                  &lt;/td&gt;
                  &lt;td class="ms-vb2"&gt;&lt;%# Eval("TrainingReason")%&gt;&lt;/td&gt;
              &lt;/tr&gt;
          &lt;/ItemTemplate&gt;
          ...
  </code></pre>