This project is read-only.

How to select a row programmatically?

May 16, 2009 at 4:35 PM


in the description I found that SelectedDataRows will be used to get or to set which row(s) are selected.
To get which ones are selected works fine but how to set using an array of objects?



May 16, 2009 at 5:58 PM

you must convert that array into an array of datagrid rows :) and then you can select them

May 16, 2009 at 6:16 PM

Thanks ... Maybe you've a short sample for as I already spend a couple of hours to do so ...

May 17, 2009 at 8:56 AM

how did you databind your array to grid?

May 17, 2009 at 10:23 AM

I use the extension for the DataSource:

DataTable dt = MDB.getActivities(7) ;
DevAge.ComponentModel.BoundDataView bd = new DevAge.ComponentModel.BoundDataView(dt.DefaultView);
ntGrid.DataSource = bd;

May 19, 2009 at 5:15 PM

it should work somthing lik this

ntGrid.Selction.SelctedDataRow = dt.rows[myRowIndex];

May 22, 2009 at 9:22 AM

ntGrid.SelectedDataRows = dt.Rows[0]; reports that dt.Rows[0] can't be converted to object.

However ntGrid.Selection.SelectRow(0,true) works fine for me.

Thanks for your support.