471,348 Members | 1,333 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,348 software developers and data experts.

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

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
1 4795
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.

Similar topics

4 posts views Thread by dont bother | last post: by
4 posts views Thread by Steve | last post: by
reply views Thread by Ambica Jain | last post: by
1 post views Thread by Tim Kelley | last post: by
1 post views Thread by Ronak mishra | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.