You can use an IIF statement in the ItemTemplate like this when you get the
value from the database:
Checked='<%# IIF(DataBinder.Eval(Container,
"DataItem.Boolean"),"true","false") %>'
Or, if the database already has a boolean, you ca do this:
Checked='<%# DataBinder.Eval(Container, "DataItem.Boolean") %>'
More code below.
Does this help?
Ken
Microsoft MVP [ASP.NET]
<asp:TemplateColumn HeaderText="Boolean Value">
<ItemTemplate>
<asp:CheckBox id=match runat="server" onCheckedChanged="updateStatus"
Checked='<%# DataBinder.Eval(Container, "DataItem.Boolean") %>'
AutoPostBack="True">
</asp:CheckBox>
</ItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn HeaderText="Boolean Value">
<ItemTemplate>
<asp:CheckBox id="Checkbox1" runat="server"
onCheckedChanged="updateStatus" Checked='<%# IIF(DataBinder.Eval(Container,
"DataItem.Boolean"),"true","false") %>' AutoPostBack="True">
</asp:CheckBox>
</ItemTemplate>
</asp:TemplateColumn>
Sileesh said:
Hi
I have datagrid with 8 items. Out of which 2 items are checkboxes. Data is
binded dynamically to the datagrid
Based on some values from the database I have to check or uncheck the
checkbox in the datatgrid.
Does any one know how to do this?
Thx
Sileesh