I am trying to implement the following
User is entering data in a grid.. one of the columns is handled by a drop down (can be a value list or any of the drop down, I have not preferrence)
If the data is not in the list, user is asked if he wants to create this new entry... if he says yes... a dialog window will ask him to fill in the required fields.
I have been able to do this with a ultraComboEditor in a form, using the ItemNotInlist Event.
However, when trying to do the same in a grid.. and using and UltraComboEditor as my EditorComponent, I always get stuck on the Grid.Error event and never get to the NotInListEvent.
I have played around with the grid update method... but it seems that its the cell update that is firing the error.
Anything I am not getting ?
Thanks
Using the CellDataError event, I am able to trap the missing element, show a dialog window to allow to enter complete the new record, replace the cell Id value with the newly created ID.
Once I have done all this, I would like to mute the Error Message "Unable to update the data value, Value is the editor in not valid " which is not true at this point anyway.
The Error is now in the ERROR event....I just added a ErrorFixed variable in the CellDataError event which i make true after adding the missing item in the valuelist.
now I can just do e.cancel = true in the Error Event and its all good
Hi Fred,
There's no ItemNotInList event on the grid, and the one on the Combo will not fire when that combo is used in the grid. So you will need to handle this in a grid event, not an event of the combo.
In theory, you could use the grid's Error or CellDataError events for this. Assuming you have set the column's Style to DropDownValidate, then one or both of these events should fire when the user enters something into the cell that does not exist on the list. But I haven't tried it, so I can't say for sure that it's possible in those events.
If those events don't work, then BeforeCellUpdate or BeforeExitEditMode would be my next choice of events. You could use cell.ValueList.GetValue to determine if that the user typed in has a matching value on the list. The method will return the index of the item or -1 if it's not found.
I'm not sure about that, but did you try the BeforeCellUpdate event? You can check if the value is not in the list and add it.