Setting checked value for Eval(bool)
You are using plain HTML checkbox
to bind data to plain HTML checkbox you must use checked="checked"
If you use ASP.NET Checkbox control then your original code will work smoothly.
There is a difference between plain HTML controls & ASP.NET controls when binding data.
//for asp.net checkbox
<asp:CheckBox ID="IdCheckBox" runat="server" Checked="<%# Convert.ToBoolean(Eval("AutoRenew")) %>" />
//for plain html checkbox
<input type="checkbox" <%# Convert.ToBoolean(Eval("AutoRenew")) ? "checked" : "" %> />
Desired output HTML should get you on the way:
<input type="checkbox" checked="checked" />
<input type="checkbox" />
This means that, to NOT check the checkbox, you should not mention the checked
attribute in the output at all, not even with a value of false.
Add checked
attribute if Convert.ToBoolean(Eval("AutoRenew"))
is true
<input type="checkbox"
<%# Convert.ToBoolean(Eval("AutoRenew")) ? "checked" : string.Empty %> />