datagrid row selection

G

Guest

Hey all,

I have a datagrid that has a select column. I've bound an untyped data table
to the datagrid and was just wondering how I would get to all the values of a
row when a user selects a row?

Is there more than one way to do this?

thanks,
rodchar
 
G

Guest

Hi,
I have used the following method with my .Net version 1.1:
private void DataGrid1_ItemCommand(object sender, DataGridItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType ==
ListItemType.AlternatingItem)
{
firstColVal = e.Item.Cells[0].Text;
secondColVal = en.Item.Cells[1].Text;
.....
}
}

If you have webcontrols such as dropdown list, radio buttons or check boxes
inside each of the rows and wish to retrieve the values for those, you'd need
to use the FindControl() function (I think).
Hope that helps.
Cheers,
Calvin
 
G

Guest

thank you, this helped.

Calvin KD said:
Hi,
I have used the following method with my .Net version 1.1:
private void DataGrid1_ItemCommand(object sender, DataGridItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType ==
ListItemType.AlternatingItem)
{
firstColVal = e.Item.Cells[0].Text;
secondColVal = en.Item.Cells[1].Text;
.....
}
}

If you have webcontrols such as dropdown list, radio buttons or check boxes
inside each of the rows and wish to retrieve the values for those, you'd need
to use the FindControl() function (I think).
Hope that helps.
Cheers,
Calvin
rodchar said:
Hey all,

I have a datagrid that has a select column. I've bound an untyped data table
to the datagrid and was just wondering how I would get to all the values of a
row when a user selects a row?

Is there more than one way to do this?

thanks,
rodchar
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,535
Members
45,007
Latest member
obedient dusk

Latest Threads

Top