When adding a new row using the AddRow feature of UltraGrid, I need to create auxiliary data when create/edit is initiated, and when the user cancels adding the row, the auxiliary data also has to be deleted.
Any suggestions?
I don't think so. If you make a change directly to the data source, instead of the grid, then the grid is a consumer of those events. It doesn't fire an event. But if you are adding a row to your data source directly, then you typically know that you did that and you don't need the grid to fire an event to tell you that it happened.
If you are adding rows both via the UI (the grid) and in code, then another option you might want to consider is to see if there are appropriate events on the data source that you could handle. DataTable and other data sources implement IBindingList, which has events for when the list changes.
Will Before/AfterRowInsert fires when programmatically inserting a row to the DataTable directly? Since I'm only concern when the row is added using AddRow, I want to know if I have to check if the row is inserted in some other way.
Thanks,
I would use Before/AfterRowInsert instead of BeforeEnterEditMode. This event fires at the point at which the grid creates the new row in the data source, but before the user has entered any new data in to the row. BeforeEnterEditMode will fire for any cell in the grid, both for AddNew rows and existing rows. So you could check IsAddRow inside that event and check to see if there is already data in the row in order to identify when the row is created. But using Before/AfterRowInsert is probably simpler.
Hello,
Thank you for contacting Infragistics!
You can use the before enter edit mode event to add your auxiliary data:www.infragistics.com/.../wingrid-beforeentereditmode-event
As for removing that info you can try the before exit edit mode:www.infragistics.com/.../wingrid-beforeexiteditmode-eventor before roe cancel update:www.infragistics.com/.../infragistics.win.ultrawingrid~infragistics.win.ultrawingrid.ultragrid~beforerowcancelupdate_ev