Is it possible to make the grid data-entry only? and disable edits to existing rows?
I am adding new rows using a fixed template row at the bottom with an ADD button.
Thanks
You could try something like this:
private void ultraGrid1_InitializeRow(object sender, InitializeRowEventArgs e) { if (e.Row.IsAddRow | e.Row.IsTemplateAddRow) e.Row.Activation = Activation.AllowEdit; else e.Row.Activation = Activation.NoEdit; } private void ultraGrid1_AfterRowUpdate(object sender, RowEventArgs e) { e.Row.Activation = Activation.NoEdit; }
This KB article might also help: HOWTO:How can I make a grid or a column, row, or cell in the UltraWinGrid disabled or read-only?
This code works for somewhat but I want the newly added code to stay as new until I save my records to the database instead what it does, if I switch between row then its become a not a new row anymore. How to prevent this, Stay as a new record, allow editing until I save and refresh the whole Grid.
Code :
if (e.Row.IsAddRow | e.Row.IsTemplateAddRow) { e.Row.Cells["User ID"].Activation = Activation.AllowEdit; e.Row.Cells["Name"].Activation = Activation.AllowEdit; e.Row.Cells["Menu"].Activation = Activation.AllowEdit; e.Row.Cells["Allowed"].Activation = Activation.AllowEdit; } else //e.Row.Activation = Activation.NoEdit; { e.Row.Cells["User ID"].Activation = Activation.NoEdit; e.Row.Cells["Name"].Activation = Activation.NoEdit; e.Row.Cells["Menu"].Activation = Activation.NoEdit; }
Never mind, I did it with a old method using a variable.