By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,562 Members | 1,292 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,562 IT Pros & Developers. It's quick & easy.

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

P: n/a
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...
Feb 14 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
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.

Feb 14 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.