EManning EManning - 11 months ago 113
Vb.net Question

Two radgridviews - programmatically select row on 2nd based on selection on 1st

I have two radgridviews where a row selected on grid #1 by the user appears automatically in grid #2. The new row in grid #2 needs to be programmatically selected as there may be further processing for that new row and the row index is needed.

Both grids use a datatable for their items source.

It is possible that the user can select the same item twice from grid #1. So the selected row in grid #2 must be the most current selection from grid #1.

How do I programmatically select the new row in grid #2?



Datagrid in wpf is a derive class of ItemsControl which has the SelectedIndex property which you can use to get the first index of selection in your grid after which you can set the second grid selectedIndex to the first's.

 int selectedIndex=grid1.SelectedIndex ;
 grid2.SelectedIndex =selectedIndex.