We have business logic that should conditionally allow a user to click to (or otherwise move to) a row and begin editing. The closest event I can find is the beforerowactivate event, but this is not an event that can be cancelled. Is there a way to do this or perhaps the most recent version of the grid has an event for this? Thanks for any help!
Okay, but just to be clear, this does not actually prevent the activation of the row, it just activates some other row after the row has already been activated.
If you do not want a particular row in the grid to be activated, you should use the Activation property on the row to disable it.
You can prevent row activation by responding to the AfterRowActivate event.
I am using a binding source and this seems to work for me (I get no flicker):
private UltraGridRow _activeRow = null;public UltraGridRow ActiveRow { get { return _activeRow; } set { _activeRow = value; }}
private bool _cancelActivate = false;private bool CancelActivate { get { return _cancelActivate; } set { _cancelActivate = value; }}
private void gridInvestors_AfterRowActivate(object sender, EventArgs e) { if (ActiveRow != null && CancelActivate) { gridInvestors.ActiveRow = ActiveRow; } ActiveRow = gridInvestors.ActiveRow;}
I also have this issue. I agree there is no way to prevent the currentManager from activating a particular row, but in this case it's the user that is activating the row not the CurrencyManager. There should be a way to cancel the user event of the row being activated. One thing I've thought of but haven't tried is to handle the BeforeSelectChange event(which is also called during activation) and if you want to cancel the row activation simple re-active the old row. Would this work?
Hi,
This is really not feasible for the grid to do. The grid's active row stays in synch with the Current position of the CurrencyManager. There is no way to prevent the currency manager from activating a particular row, so there's no way for the grid to do so, either.
You could use the Activation or CellActivation to disable the row. HOWTO:How can I make a grid or a column, row, or cell in the UltraWinGrid disabled or read-only?