I have a readonly UltraGrid that is bound to a datasource that contains an ID column as the PK for the collection. I would like to select a specific row based upon the ID and highlight/activate it programmatically. The grid should scroll to the proper location if the selected row is not visible.
QUESTION: Is there an example of how I can do this?
The grid follows the current record of the data source to which it is bound by default, meaning you would just have to set the binding manager's Position property to the index of the record that you want to "select":
UltraGrid grid = this.ultraGrid;BindingManagerBase bm = grid.BindingContext[grid.DataSource, grid.DataMember];bm.Position = 0;
Note that you can also select and activate an UltraGridRow programmatically; set the UltraGrid.ActiveRow property to activate the row, and use the Rows property of the Selected object to select a row:
this.ultraGrid.ActiveRow = row;this.ultraGrid.Selected.Rows.Add( row );
Brian,
If there are too many rows in the grid and the grid has a scroll bar , how to get that particular row in view? system shud automatically scroll the grid to that row...
Thanks!
Swetha.