I have an UltraGrid bound to a DataTable with AllowAddNew = AllowAddNew.TemplateOnBottom. I have a column with an EditorComponent of UltraComboEditor and another column with EditorComponent of UltraTextEditor.
It should NOT allow editing of existing rows. I can accomplish this by disabling updating, HOWEVER, this is also disabling the AddNew template which is no longer editable so no new values can be selected for the new row. Is there a way to keep the AddNew template row editable but disable editing on the rest of the grid? Why are those not separate? I'm not sure what combination of settings to add here and I have tried several. I even tried the BeforeCellActivate method with IgnoreRowColActivation = true on the specific columns but no success.
Thanks
Hello Sam,
I have been investigating into the behavior you are looking to achieve where you allow editing on the add row of the UltraGrid, but not on the existing data rows, and in order to achieve this, I would recommend handling the BeforeEnterEdit event of the UltraGrid.
By handling this event, you can check the UltraGrid.ActiveRow.IsAddRow property, as in order for a row to go into edit mode, it will need to be active. If this property is false, you can cancel the event by setting the Cancel property of the event arguments to true. This will prevent the existing data rows from entering edit mode while allowing the add new row to be edited.
Please let me know if you have any other questions or concerns on this matter.
Thank you, I'll try it out and update you.
One thing I just noticed is that the "add new" row does not display when the grid is empty (no records to load). Should it not be displayed all the time, instead of only when the grid already has data?
The UltraGrid should still show an add new row when empty, but it needs to have an empty collection or table set as its DataSource so it has a place to put the new data items. If the add new record is not showing for you, I am under the impression that the DataSource property of the grid is not set.