H
hazz
The following code generates checkbox values from the database. Once the
user selects/deselects checkbox values, is there a way to obtain the ID and
Checkbox.Checked state from these BoundColumns so I can update the table
they came from? Thank you. -Greg
<aspataGrid id="ItemsGrid" runat="server"
OnItemDataBound="Item_Bound" AutoGenerateColumns="False"
AllowSorting="True">
<Columns>
<asp:BoundColumn HeaderText="ID"
ReadOnly="True"
DataField="ID"/>
<asp:BoundColumn HeaderText="Column_Name"
ReadOnly="True"
DataField="ColumnName"/>
<asp:TemplateColumn>
<ItemTemplate>
<asp:CheckBox ID="CheckBox1"
Text=""
runat="server"/>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
void Item_Bound(Object sender, DataGridItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.Item)
{
CheckBox check = (CheckBox)e.Item.FindControl("CheckBox1");
if (check != null)
{
check.Checked =
Convert.ToBoolean(((SSI.ColumnsForReport)(e.Item.DataItem)).Include_in_Report);
}
}
user selects/deselects checkbox values, is there a way to obtain the ID and
Checkbox.Checked state from these BoundColumns so I can update the table
they came from? Thank you. -Greg
<aspataGrid id="ItemsGrid" runat="server"
OnItemDataBound="Item_Bound" AutoGenerateColumns="False"
AllowSorting="True">
<Columns>
<asp:BoundColumn HeaderText="ID"
ReadOnly="True"
DataField="ID"/>
<asp:BoundColumn HeaderText="Column_Name"
ReadOnly="True"
DataField="ColumnName"/>
<asp:TemplateColumn>
<ItemTemplate>
<asp:CheckBox ID="CheckBox1"
Text=""
runat="server"/>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
void Item_Bound(Object sender, DataGridItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.Item)
{
CheckBox check = (CheckBox)e.Item.FindControl("CheckBox1");
if (check != null)
{
check.Checked =
Convert.ToBoolean(((SSI.ColumnsForReport)(e.Item.DataItem)).Include_in_Report);
}
}