Hi guys
I need to provide the following functionality using the grid. A specific column cell activation will always be disabled except when creating new and only the newly created row for this specific column must always remain editable while all other rows for this column must remain disabled.
Hello Elsworth,
I have been investigating this requirement that you are looking to achieve, and it sounds like you are looking for certain cells in your UltraGrid to be read only, but for that same column, have the add-new row be editable. If this is not the case, please let me know as the following is based on that impression.
In order to achieve this, I would recommend utilizing the BeforeRowUpdate event on the UltraGrid. This will fire for the add new row when it commits, and the event arguments can net you the row element using the Row property. You can then check for IsAddRow being true for this row to see if this event firing is coming from the add-new row.
If it does come from the add-new row, you can index into the Cells collection of that row, which has an Activation property. If you set this to Activation.NoEdit for certain cells, you can prevent edit mode on the newly committed row for certain cells.
I am attaching a sample project to demonstrate the above. I hope this helps you.
Please let me know if you have any other questions or concerns on this matter.
UltraGridCellActivationCase.zip
Hi
you or of on the right track. Please can you put together a demo of this:
Grid is pre-populated with 5 records from the datasource. Column A cell activation is disabled for existing data and the existing data in this column must not be editable. when creating a new row in the grid this cell in column A must be editable and must stay editable for the newly created rows added to the grid.
Let me know if you need more info.
I have modified the originally attached sample project to demonstrate your requirement. In this case, the BeforeRowUpdate event is no longer needed, as you can simply loop through the UltraGrid.Rows collection, indexing into each UltraGridRow's Cells collection and setting the Activation property for the first cell at the start. This will continue to allow editing in the add-new row and the rows created by it.
I am attaching the modified version of the sample project.
1581.UltraGridCellActivationCase.zip