Hello,
Dim
The problem is that XBindingSource.Current is always nothing, and thus x is always nothing despite there being items in the grid and with one of the rows selected.
Does anyone have any ideas why the 'current' property is nothing?
NB: This grid is editable, and I have set the 'CellClickAction' property to be 'EditAndSelectText' - could this be part of the problem?
Thank you very much Mike. It was a cracking answer!
After I switch to AfterSelectChange event, Grid.Selected.Rows returns the correct collection.
Jun
Hi Jun,
It's impossible to provide you with a solution without knowing the cause of the problem. If AfterRowActivate is firing and returning the wrong row, then something is wrong. I've never seen this happen, though.
Can you duplicate this in a small sample project?
It sounds to me like you might be confusing Active and Selected. These are two completely different things. If you are trying to get the selected rows, then AfterRowActivate is the wrong event. You should use AfterSelectChange.
Hi Andy,
grid.Selected.Rows does NOT have the correct value within AfterRowActivate event handler.
The software I'm working on requires certain operations when one or several data rows are selected.
Can you advice what's the best approach?
Regards,
Thanks Andy
Hi,
To identify the currently selected row(s) in the grid use the UltraGrid.Selected.Rows collection. If you have enabled UltraGrid.DisplayLayout.Override.SelectTypeRow = Infragistics.Win.UltraWinGrid.SelectType.Extended then there can be more than one item in the collection.
To get to the underlying bound data from there you can use the ListObject property of the row.
Andy.