I can get the row indexes using the following codes. but problem is
that when I clicked the grid column header , it still printed out the
same indexes. So the dataview here reflects the row indexes in the
data source instead of the datagrid. What I want are the row indexes
in the datagrid. How can I do it? Thanks.
private void PrintRowIndexes(DataGrid dg)
{
CurrencyManager cm =
(CurrencyManager)this.BindingContext[dg.DataSource, dg.DataMember];
DataView dv = (DataView)cm.List;
Console.Write ("Indexes: " );
for(int i = 0; i < dv.Count; ++i)
{
if(Convert.ToString (dv[i]["yes_no"]) == "no") {
Console.Write ("{0}\t", i);
}
}
Console.WriteLine ();
}
These always printed the same set of indexes no matter which column
headers I clicked (I called it from datagrid_MouseDown event).