Hey guys,
I need a combo box that validates the value entered and also it allows empty values.
DropDownValidate seems to do the trick since it offers type-ahead functionality and it also verifies the value entered is part of the data source.
The problem is that even when the underlying column type is string (obviously allows nulls) and also an empty item (and a null item) has been added to the list, the grid keeps showing the following message:
"Unable to update the data value: Value in the editor is not valid"
Is this expected behavior? so does DropDownValidate definitely not like nulls?
I read somewhere that a solution is to validate manually with the BeforeCellUpdate event. So I was writing to see if this the "best and easy" way to do it. Since it looks to me that the DropDownValidate style has a silly limitation.
Thanks.
ureys84,
ureyes84 said:Is this expected behavior?
There are two options:
Hey thanks for your reply.
I had already gone for this first option, I had added a value with an empty string and I got the same result. That's exactly the reason why I asked if it was the expected behavior.
I guess I'll have to go for the second option.
Thanks !
ureyes84 said:I had added a value with an empty string and I got the same result.
What kind of object is your grid bound to? Is it an ADO.NET object (such as DataView, DataTable, or DataSet), an Entity (such as generated by LINQ), or a custom business object? Also, what's the data type of the property/column in your data source that corresponds to the grid colum you're editing?
Vince McDonald"]What kind of object is your grid bound to?
It's a custom business object list. I tried adding an empty object (with empty strings) and also a null value.
myList.Add(newCustomObject())
myList.Add(null)
Vince McDonald"]what's the data type of the property/column in your data source that corresponds to the grid colum you're editing?
String.
ok,
I was adding the empty object like this:
vvlList.Insert(0, new ValidvaluesBO() { Code=null});
and setting the Nullable property to Nothing:
column.Nullable = Infragistics.Win.UltraWinGrid.Nullable.Nothing;
and also to
column.Nullable = Infragistics.Win.UltraWinGrid.Nullable.Null;
It did not work so I did it using empty strings:
vvlList.Insert(0, new ValidvaluesBO() { Code=string.Empty});
column.Nullable = Infragistics.Win.UltraWinGrid.Nullable.EmptyString;
which worked like a charm. I think it's interesting it liked the empty string but not the null value. even though the underlying data type is string.
ureyes84 said:It's a custom business object list.
ureyes84 said:String.
You should use the "empty object with empty strings" approach to adding the object to your list.