I have a asp.net grid view and i have
IsActive field in database and it comes as 1 or 0.So i need according to that value Grid view Checkbox is checked or not.
Grid View Field
<asp:TemplateField> <ItemTemplate> <asp:CheckBox ID="chkIsActive" DataField="ISACTIVE" HeaderText="Is Active" runat="server" Checked='<%# Eval("ISACTIVE") %>'/> </ItemTemplate> </asp:TemplateField>
GridRes gridRes = NewsProxy.GetAllnews(req); gv.DataSource = gridRes.Dataset; gv.DataBind();
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
IsActive field is a
bit column and contains only
1 then you can do like below in order to pre-check or unchech the
<asp:CheckBox ID="chkIsActive" DataField="ISACTIVE" HeaderText="Is Active" runat="server" Checked='<%# Convert.ToBoolean(Eval("ISACTIVE")) %>'/>