I have an UltraGridCell set up to receive a Boolean value.
Based on the Boolean value, I'd like to set the state of another UltraGridCell to be a required - or not.
That's to say, I'd like to set the Required attribute of an UltraGridCell conditionally.
I believe I'm using an older version of the software, a base DLL is marked as:
Thank you.
Hello Bill,
I have been investigating into your requirement and in order to achieve this I would recommend using the DataErrorInfo feature of the UltraGrid, not to be confused with the IDataErrorInfo interface, although that may be an option for you as well. This feature allows you to set “column errors” for specific rows, essentially allowing you to set cell-specific error validation. You can read about utilizing this feature here.
I hope this helps you. Please let me know if you have any other questions or concerns on this matter.
It looked like it was working, but it still allows rows to be pushed to the backend for update. I also tried to set a RowError, in addition to the cell(column) error, in hopes of preventing the update, but that didn't work.
Hi Bill,
Your original post didn't mention preventing the updates to the back end.
Applying errors to the grid via the DataErrorInfo property just displays error messages in the grid. It has no effect on the data source or pending changes.
If you are using a DataTable/DataSet, then you could try applying the errors to your data using the IDataErrorInfo interface, which DataTable and DataSet support. To make these errors display in the grid, you would just set:
this.ultraGrid1.DisplayLayout.Override.SupportDataErrorInfo = Infragistics.Win.UltraWinGrid.SupportDataErrorInfo.RowsAndCells;
Having said that, I'm not sure exactly what you are asking here. The grid has no interaction with the back end (the data base). It only deals with the local data source. So if you are asking about preventing the data source from updating the data base, then that's not really something I'm expert in. If you apply IDataErrorInfo information to the DataSet or DataTable, I don't know if that will prevent the DataAdapter from updating those rows to the back end. Of perhaps you are supposed to manually check the HasErrors property on the DataTable before you perform the update. If you are talking about preventing the grid from committing the changes to the local data source, then "back and" is not the right term. But to do something like that, you would probably need to use events of the grid like BeforeRowUpdate. And you will probably want to set RowUpdateCancelAction on the grid, as well:
this.ultraGrid1.RowUpdateCancelAction = Infragistics.Win.UltraWinGrid.RowUpdateCancelAction.RetainDataAndActivation;