Jeff Fillegar
asked on
asp.net gridview with checkbox
Hello experts,
I have a gridview with a checkbox column. I am binding the gridview to a dataset. The first column in the dataset is bool (true\false). When the page loads, how can I programmatically check the check boxes if the dataset column == true?
Thanks in advance.
<asp:GridView ID="gvPayments" runat="server" AutoGenerateColumns="false "
DataKeyNames="rowid" GridLines="None" AllowPaging="false" CssClass="gvGrid"
PagerStyle-CssClass="pgr" AlternatingRowStyle-CssCla ss="alt"
>
<Columns>
<asp:TemplateField>
<HeaderTemplate>
<asp:CheckBox ID="ChkAll" runat="server" />
</HeaderTemplate>
<ItemTemplate>
<asp:CheckBox ID="chkSel" class="chkSel" runat="server" />
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="path" HeaderText="path"
SortExpression="path" />
<asp:BoundField DataField="valuetext" HeaderText="value"
SortExpression="valuetext" />
</Columns>
</asp:GridView>
I have a gridview with a checkbox column. I am binding the gridview to a dataset. The first column in the dataset is bool (true\false). When the page loads, how can I programmatically check the check boxes if the dataset column == true?
Thanks in advance.
<asp:GridView ID="gvPayments" runat="server" AutoGenerateColumns="false
DataKeyNames="rowid" GridLines="None" AllowPaging="false" CssClass="gvGrid"
PagerStyle-CssClass="pgr" AlternatingRowStyle-CssCla
>
<Columns>
<asp:TemplateField>
<HeaderTemplate>
<asp:CheckBox ID="ChkAll" runat="server" />
</HeaderTemplate>
<ItemTemplate>
<asp:CheckBox ID="chkSel" class="chkSel" runat="server" />
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="path" HeaderText="path"
SortExpression="path" />
<asp:BoundField DataField="valuetext" HeaderText="value"
SortExpression="valuetext"
</Columns>
</asp:GridView>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.