Reputation:
How do I check the checkbox in gridview on the database bit '1' and uncheck on '0' automatically and then submit the checked values into database? please help me.
Upvotes: 0
Views: 893
Reputation:
I tried this and it simply did the job:
<asp:TemplateField HeaderText="Is Active">
<ItemTemplate>
<asp:CheckBox ID="Chk" runat="server" Checked='<%# Bind("fieldname") %>' />
</ItemTemplate>
</asp:TemplateField>
Upvotes: 1
Reputation: 4673
A templated field may work:
<asp:TemplateField HeaderText="Serial Number" SortExpression="SERIALNUMBER" >
<ItemTemplate>
<asp:CheckBox ID="CheckBox1" runat="server" Checked='<%# iif(Bind("FIELD")=0,"False","True") %>' />
</ItemTemplate>
</asp:TemplateField>
Upvotes: 0
Reputation: 34367
This should get you going
http://www.asp.net/Learn/data-access/tutorial-52-vb.aspx
Upvotes: 0