I have a gridview with one column having a checkbox. I want to bind the gridview to the datasource and check/uncheck checkboxes accordingly depending on the predefined status values; (1 for true and 0 for false).
This is my try:
<asp:TemplateField HeaderText="Cerrada">
<ItemTemplate>
<asp:CheckBox ID="CBCerrada" runat="server" Checked="<% if (Eval("cerrada").ToString() == "1") { %>true<% } else if (Eval("cerrada").ToString() == "0") { %>false<% } %>" />
</ItemTemplate>
</asp:TemplateField>
But I get the following error: "Server tags cannot contain <% … %> constructs"