how to get selected row after sorting a DataViewGrid ???

  • Thread starter Thread starter cmrchs
  • Start date Start date
C

cmrchs

Hi,

I have a DataViewgrid that is filled with records sorted on a column 'Date'.When double-clicking on a row do I view the selected row in another window. So far so good

But when I sort the DataViewgrid on another column and dbl-click again do I get a different row than the one selected ???

How can I make sure that the selected row is always shown ?

thnx
Chris


**********************************************************************
Sent via Fuzzy Software @ http://www.fuzzysoftware.com/
Comprehensive, categorised, searchable collection of links to ASP & ASP.NET resources...
 
Hi .. do not use row indexing by numbers but use its DataBound object
property.

Exapmle:

DataGridView dgv = new DataGridView();
DataGridView subdgv = new DataGridView();
dgv.RowEnter += new DataGridViewCellEventHandler(dgv_RowEnter);

void dgv_RowEnter(object sender, DataGridViewCellEventArgs e)
{
subdgv.DataSource =
(DataRowView)dgv.Rows[e.RowIndex].DataBoundItem;
}

you're all set.
 
Back
Top