D
Dan
I'd like to loop through selected datagrid rows and extract specified
columns from those rows. How would I do that?
Thanks...
Dan
columns from those rows. How would I do that?
Thanks...
Dan
I'd like to loop through selected datagrid rows and extract specified
columns from those rows. How would I do that?
Thanks...
Dan
How can I determine whether the row is selected in the datagrid? For
example, I click on rows 3, 7, and 9 of the datagrid. When I loop through
the dataset rows, how do I determine that they are selected?
L# said:How can I determine whether the row is selected in the datagrid? For
example, I click on rows 3, 7, and 9 of the datagrid. When I loop through
the dataset rows, how do I determine that they are selected?
Here's a little method that does the trick:
/// <summary>
/// Returns an arraylist with datarows that are selected in the
/// datagrid.
/// </summary>
/// <param name="datagrid">Datagrid.</param>
/// <returns>Arraylist with datarows that are selected in the
/// datagrid</returns>
public ArrayList GetSelectedRows(DataGrid datagrid)
{
ArrayList arrSelectedRows = new ArrayList();
DataSet dset = (DataSet)datagrid.DataSource;
for (int i=0; i<dset.Tables[0].Rows.Count; i++)
{
if (datagrid.IsSelected(i))
{
DataRow drow = dset.Tables[0].Rows;
arrSelectedRows.Add(drow);
}
}
return arrSelectedRows;
}
If the grid is sorted then this code won't work. Is there a solution
for this problem with grid sorting enabled?
Thank you.