i have a asp.net page in which I have made a gridview which contains asp.net checkboxfield , what i want is when i retrieve the data from the database which will be a bit either 1 or 0 then the checkbox should be checked if it is 1 or unchecked if it is
0
spartynaved
Member
3 Points
34 Posts
how to checked a checkbox at a time of receive value from the database
Jun 02, 2012 01:49 PM|LINK
i have a asp.net page in which I have made a gridview which contains asp.net checkboxfield , what i want is when i retrieve the data from the database which will be a bit either 1 or 0 then the checkbox should be checked if it is 1 or unchecked if it is 0
feel free to change my mark up
<asp:GridView ID="gv_Pages" runat="server" CssClass="label" AllowPaging="true" AllowSorting="true" AutoGenerateColumns="false" Width="151%"> <HeaderStyle ForeColor="White" BackColor="#0E8DF5" HorizontalAlign="Left" /> <Columns> <asp:TemplateField> <ItemTemplate> <asp:CheckBox ID="checkBox" runat="server" /> </ItemTemplate> <HeaderTemplate> <asp:CheckBox ID="cb_To_Select_All" runat="server" AutoPostBack="true" /> </HeaderTemplate> <HeaderStyle ForeColor="White" BackColor="#0E8DF5" Width="10%" /> </asp:TemplateField> <asp:BoundField HeaderText="Page" DataField="Page_ID" /> <asp:CheckBoxField HeaderText="Add" DataField="CanAdd" /> <asp:CheckBoxField HeaderText="Delete" DataField="CanDelete" /> <asp:CheckBoxField HeaderText="Update" DataField="CanUpdate" /> <asp:CheckBoxField HeaderText="View" DataField="CanView" /> </Columns> <SelectedRowStyle ForeColor="White" Font-Bold="True" BackColor="#FFFFFF"></SelectedRowStyle> <RowStyle BackColor="#FFFFFF" ForeColor="Black" HorizontalAlign="Left" ></RowStyle> </asp:GridView>