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
220
How to allow column insert but not column update?
posted

Hello,

We are using UltraWinGrid. In a row, there are certain UltraGridColumn that the user is allowed to edit and some not allowed to edit. The user is allowed to add a new row though. However, when we use CellActivation = Activation.NoEdit, the column is also uneditable in the addrow. How can we allow a column to be editable in the addrow but become uneditable in the other rows?

  • 17259
    Offline posted

    You can check the row type in the BeforeRowActivate event and override the column behavior:

    private void ultraGrid1_BeforeRowActivate(object sender, Infragistics.Win.UltraWinGrid.RowEventArgs e)

    {

       if (e.Row.IsUnmodifiedTemplateAddRow)

       {

          foreach (var cell in e.Row.Cells)

          {

             cell.IgnoreRowColActivation =
    true;         cell.Activation = Infragistics.Win.UltraWinGrid.Activation.AllowEdit;

          }

       }

       else

       {

          foreach (var cell in e.Row.Cells)

          {

             cell.IgnoreRowColActivation =
    false;

          }

       }

    }