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
560
AllowAddNew in combination with AllowEdit
posted

Hello,

I have a question concerning the AllowAddNew property of the Grid in combination with the AllowEdit Property in the FieldSettings.

When I  am setting FieldSettings AllowEdit = "False" the application User can't edit the values of any field which is exactly what I wanted so far. But he also hasn't the chance to determine values for the AddNew Record of the grid.

Is there a simple way to allow the User adding new Records with the help of the grids AddNew Record  AND to forbid the Editing of the existing records?

 

 

  • 69686
    Verified Answer
    posted

    Hello,

    The AllowEdit property is set per field and not per record. All the cells for the field will be editable or not based on the AllowEdit value. What you can do is cancel the EditModeStarting (e.Cancel=true;) if the record is not an AddNewRecord:

     private void xdg_EditModeStarting(object sender, Infragistics.Windows.DataPresenter.Events.EditModeStartingEventArgs e)

            {

                if (!e.Cell.Record.IsAddRecord)

                {

                    e.Cancel = true;

                }

            }