Hi!
I have a Datagrid with a column that is a checkbox.
Something like this:
<asp:datagrid id="dg2" runat="server">
<Columns>
<asp:TemplateColumn>
<ItemTemplate>
<asp:CheckBox ID="chkSelection" Runat="server" />
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
</asp:datagrid>
in an aspx. When I load de aspx i bind it with a datatable
so i get a datagrid with the columns and rows of the
datatable and the first column is a checkbox.
I now want to get the values of the rows in wich the
checkbok is checked.
I tried something like:
foreach(DataGridItem dgit in dg2.Items)
{
chkse = dgit.FindControl("chkSelection") as CheckBox;
if (chkse.Checked)
{
//code in here
}
}
so far so good. I've read that i can use another
FindControl to get the values, but I have to do a cast
(CType in VB although I am using c#) to the control as a
label and all I get is null.
Is there a way to get all the values of the row. Like an
iterator for that row in that specific DataItem?
Thank You
|