Hi,
One of the columns of my DataGridControl is using an UltraComboEditor (defined as EditorComponent in the InitializeLayout of the grid) to select potentially more than 1 value.The dropdown is filled using the following piece of code :
ValueList valList = new ValueList();
using (var ingredient = Factory.Ingredient) {
foreach (Data.DataModel.Ingredient.Tbl_Regulation_Type_Master regulationType in ingredient.GetAllIngredientRegulationTypes()) {
valList.ValueListItems.Add(new ValueListItem() { DataValue = regulationType.IRT_Regulation_Type_Id, DisplayText = regulationType.IRT_Description });
}
this.cmbRegulationType.ValueList = valList;
The list is then binded correctly, showing the correct ticked value(s) when loading the grid.Moreover, I have attached the event ValueChanged to this component to do some extra operations whenever ticking one or many values in the dropdown.
However, when I’m trying to get the Value on ValueChanged or even simply commit the row, I get the following error :
'Cannot access the Value property when the IsValid property returns false.'
I have checked Infragistics 18.1 sample project, I have the exact same implementation besides the filling of my dropdown (filled by DataTable in the sample).
Did I miss something in the declaration of the UltraComboEditor or should I simply bind it to a DataTable instead of a ValueList?
Hello Joel,
I recommend validating the cell's value or text properties and not the editor and it's valuelist the columns is assigned.
Hi Michael,
Thanks for your reply.
However, I realized that even after removing the attached event, I cannot commit the cell's value.Here's the error I get, let me know if you need some more information.
Source: Application Location: Error on: Infragistics.Win.EmbeddableEditorBase::get_Value Number: 1 Description: Cannot access the Value property when the IsValid property returns false. StackTrace: System.Exception: Cannot access the Value property when the IsValid property returns false. at Infragistics.Win.EmbeddableEditorBase.get_Value() at Infragistics.Win.EditorWithText.get_Value() at Infragistics.Win.EditorWithCombo.get_CurrentEditText() at Infragistics.Win.UltraWinGrid.UltraGridCell.CommitEditValue(Boolean& stayInEdit, Boolean fireDataError, Boolean forceDontThrowException, Boolean dontStoreInUndoHistory) at Infragistics.Win.UltraWinGrid.UltraGridCell.CommitEditValue(Boolean& stayInEdit, Boolean fireDataError, Boolean forceDontThrowException) at Infragistics.Win.UltraWinGrid.UltraGridLayout.OnEditorBeforeExitEditMode(Object sender, BeforeExitEditModeEventArgs e) at Infragistics.Win.EmbeddableEditorBase.OnBeforeExitEditMode(Boolean& cancel, Boolean forceExit, Boolean applyChanges) at Infragistics.Win.EditorWithText.OnBeforeExitEditMode(Boolean& cancel, Boolean forceExit, Boolean applyChanges) at Infragistics.Win.EditorWithCombo.OnBeforeExitEditMode(Boolean& cancel, Boolean forceExit, Boolean applyChanges) at Infragistics.Win.EmbeddableEditorBase.ExitEditMode(Boolean forceExit, Boolean applyChanges) at Infragistics.Win.UltraWinGrid.UltraGridCell.ExitEditMode(Boolean cancellingEditOperation, Boolean forceExit) at Infragistics.Win.UltraWinGrid.UltraGridCell.ExitEditMode() at Infragistics.Win.UltraWinGrid.UltraGridLayout.ExitEditModeHelper(Boolean cell, Boolean header) at Infragistics.Win.UltraWinGrid.UltraGridCell.Activate() at Infragistics.Win.UltraWinGrid.UltraGridCell.SetFocusAndActivate(Boolean byMouse, Boolean enterEditMode, Boolean byTabKey) at Infragistics.Win.UltraWinGrid.UltraGridCell.SetFocusAndActivate(Boolean byMouse, Boolean enterEditMode) at Infragistics.Win.UltraWinGrid.CellUIElementBase.OnEmbeddableElementMouseDown(Object sender, EmbeddableMouseDownEventArgs e) at Infragistics.Win.UltraWinGrid.GridEmbeddableEditorOwnerInfoBase.OnEditorMouseDown(EmbeddableUIElementBase embeddableElem, EmbeddableMouseDownEventArgs e) at Infragistics.Win.EmbeddableUIElementBase.RaiseMouseDownEvent(EmbeddableMouseDownEventArgs e) at Infragistics.Win.EmbeddableUIElementBase.OnMouseDown(EmbeddableMouseDownEventArgs e, Boolean adjustableArea, UIElement& captureMouseForElement) at Infragistics.Win.EditorWithTextUIElement.OnMouseDown(MouseEventArgs e, Boolean adjustableArea, UIElement& captureMouseForElement) at Infragistics.Win.UIElement.OnMouseDown(MouseEventArgs e, Boolean adjustableArea, UIElement& captureMouseForElement) at Infragistics.Win.TextUIElementBase.OnMouseDown(MouseEventArgs e, Boolean adjustableArea, UIElement& captureMouseForElement) at Infragistics.Win.EditorWithTextDisplayTextUIElement.OnMouseDown(MouseEventArgs e, Boolean adjustableArea, UIElement& captureMouseForElement) at Infragistics.Win.ControlUIElementBase.ProcessMouseDownHelper(Object sender, MouseEventArgs e) at Infragistics.Win.ControlUIElementBase.ProcessMouseDown(Object sender, MouseEventArgs e) at Infragistics.Win.Utilities.ProcessEvent(Control control, ProcessEvent eventToProcess, EventArgs e) at Infragistics.Win.UltraWinGrid.UltraGrid.OnMouseDown(MouseEventArgs e) at System.Windows.Forms.Control.WmMouseDown(Message& m, MouseButtons button, Int32 clicks) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
Please let me know if you need some more information.
Having your IDE break on all run-time exceptions will cause this type of exception to occur since the grid should prevent this automatically. However, it doesn't appear the entered text in the cell isn't valid for the dropdown. The column's datatype and the valuelist should be the same type.