I have a fixed add row on the top of the grid. In the initializerow event, I would like to know whether I am in the fixed add row or a regular row in the grid, so I can disable cell activation on a cellbutton column. Checking isTemplateAddRow always returns false, and checking the index property (for index > 0) doesn't seem to work either. Is there a way to do this?
Thanks,
Bob
Inside the InitializeRow event, you can add code similar to the following:
if ( !e.Row.IsAddRow ) { e.Row.Cells["Code"].Activation = Activation.Disabled; }
Hope this helps.
Chris
Thanks. Unfortunately I failed to mention in my initial post that I had already tried what you suggested and it doesn't work. It seems like the logical thing to do, but maybe it doesn't work with FixedAddRowOnTop.
private void ultraGrid1_InitializeTemplateAddRow(object sender, InitializeTemplateAddRowEventArgs e) { if (!e.TemplateAddRow.IsAddRow) { e.TemplateAddRow.Cells["columnName"].Activation = Activation.Disabled; } }
That's the opposite of what I wanted to do. I want the FixedAddRowOnTop to have a particular column enabled, and all other rows to have that column disabled.
So you probably need to disable all of the columns and just enable the cell using the InitializeTemplateAddRow event. This article should help:
HOWTO:How can I make a grid or a column, row, or cell in the UltraWinGrid disabled or read-only?