Selecting Values in a DataGrid, via a checking a CheckBox
Hello,
I am fairly new to C# and .NET.
I am trying to select values in a DataGrid on a Button_Click event, if that particular row has a CheckBox checked.
There 3 columns in my DataGrid, startTime, endTime which are both databound and a checkbox column which is not.
Then these values will be passed in to by sql 2000 DB.
This is what I have done so far…..
private void Button_Click(object sender, System.EventArgs e)
{
int i = 0;
CheckBox cb;
foreach (DataGridItem dgi in this.DataGrid1.Items)
{
cb = (CheckBox) dgi.Cells[0].Controls[1];
if(cb.Checked)
{
//Not too sure what to do here, but no idea if the above works?
}
i++;
}
}
Could some please help, any help would be much appreciated.
I would like to do this in the code behind aspx.cs
Thanks,
Tom