Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
475
Allow edit in AddRow but not on the existing rows
posted

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

Parents
No Data
Reply
  • 34810
    Offline posted

    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.

Children