I get an error of
Specified cast is not valid
when I try to run my syntax. What I am wanting to do is if the value in the database is yes check the checkbox, if it is no, then do not check the checkbox. Here is my HTML that shows how I am trying to do such:
<asp:GridView runat="server" ID="dg123" AutoGenerateColumns="false" CssClass="DataGrids" GridLines="Both" ShowFooter="true">
<FooterStyle CssClass="DataGridFooters" /><HeaderStyle CssClass="DataGridHeaders" />
<Columns>
<asp:BoundField DataField="abc" HeaderText="Alpha" />
<asp:BoundField DataField="efg" HeaderText="Echo" />
<asp:TemplateField>
<ItemTemplate><asp:CheckBox ID="Completed" runat="server" Checked='<%#Eval ("Completed") %>'/></ItemTemplate>
</asp:TemplateField>
</Columns>
Where in the example above, abc
efg
and Completed
are all fields in the database.
Aucun commentaire:
Enregistrer un commentaire