Hi, I'm new to UltraGrid, and need your help.
I'm trying to solve this by myself but with no success.
Using VB, or C#, no problem, what is the right sequence that I should check the events, in order to verify the user input?
I want the user to be able to insert new rows (I have a button for that), delete (also have a button) and update (simply start writing). But I must verify if all the cells have good values before I save it to the DataTable, and after that to the database.
I would like to be able to prevent the user form clicking outside the grid, during an Insert (new row) o update.
I appreciate your help. I don't want you to make my work, just point out the guidelines and if possible where I can find some examples. I already searched everywhere, but didn't find much help.
Hope you can help me on this, because I already spent more then 3 days trying it out with no success.
Thanks in advance. Best regards.
There is no OnLostFocusOrCellChange event or Enum, but there is an enum OnCellChangeOrLostFocus.
I was referring to the UpdateMode property (and it's enum values) of the grid, not a method.
Mike,
I've searched the Methods collection of UltraGrid and can't find a OnLostFocusOrCellChange event.
Am I misunderstanding something?
Tavinfor said:I defined .UpdateMode.OnUpdate. When should I can the update method? After what event?
I'm not sure, but I don't think the OnUpdate option works in DotNet. This option was carried over from the ActiveX version of the grid. But I think the BindingManager in DotNet implicitly calls EndEdit whenever the current position changes, so the grid will probably end up committing the changes any time you leave the row, anyway.
If you want to validate the data for each cell individually, then I would use OnLostFocusOrCellChange. If you want to validate a whole row at a time, use OnLostFocusOrRowChange.
Tavinfor said: Hi, thanks for your help. I have yet some unanswered situations. I defined .UpdateMode.OnUpdate. When should I can the update method? After what event? How can I prevent the user from clicking outside the grid during an update or insert? He/she shouln't be able to click on controls (textbox,...) or on buttons (command buttons, menus,...). How to prevent this? I tried BeforeCellDeactivate, but this event doesn't fire in all situations, or when it fires it's too late (if I click in a textbox, for instance, it only fires this event when the grid gets focus again, and not before).
Hi, thanks for your help. I have yet some unanswered situations.
I defined .UpdateMode.OnUpdate. When should I can the update method? After what event?
How can I prevent the user from clicking outside the grid during an update or insert? He/she shouln't be able to click on controls (textbox,...) or on buttons (command buttons, menus,...). How to prevent this? I tried BeforeCellDeactivate, but this event doesn't fire in all situations, or when it fires it's too late (if I click in a textbox, for instance, it only fires this event when the grid gets focus again, and not before).
I think you would probably have to use the Validating event of the grid in order to prevent it from losing the focus entirely. I'm not sure if this is feasible, though, since the grid often uses child controls for cell editing.