I used to have a column in my grid set as a textbox with a regexPattern. I have since changed it to a valuelist with a style of dropdownlist.
Now no matter what value is selected off of the list I get a grid_error event with the following data:
e.ErrorText: "Unable to update the data value: Value does not match the required pattern."
e.ErrorType: Data
e.DataErrorInfo.Cell.Column.Format: ""
e.DataErrorInfo.Cell.Column.MaskInput: ""
e.DataErrorInfo.Cell.Column.RegexPattern: ""
e.DataErrorInfo.InvalidValue": "03"
e.DataErrorInfo.Eception: null
e.DataErrorInfo.Cell.SelText: 'e.DataErrorInfo.Cell.SelText' threw an exception of type 'System.NotSupportedException'
e.DataErrorInfo.Cell.Text" "03"
e.DataErrorInfo.Cell.Value: " "
The Text "03" is the value selected from the valuelist and there is no regex pattern set for the column anymore.
How can I be getting a required pattern error?
This is the only column in a grid with ten other dropdownlists that is giving this error.
Any possible ideas would be appreciated.
Hi Rob,
Yeah, null and empty string can sometimes be tricky. Some properties make a distinction between the two and some don't. In this case, I guess it's a little weird - because why would you ever want to enforce a completely empty Regex pattern?
Aha! That solved it.
I probably deleted the original Regex Pattern, which retained an empty string.
When I right clicked and “RESET” the field it cleared up the problem. That was really unobvious to me.
Thanks!!
How did you clear the pattern? Did you set it to an empty string? Did you Reset it in the property grid? Did you use the ResetRegexPattern method?
This clearly must have something to do with the RegexPattern. Perhaps an empty string, like you show here, is a valid pattern. Try setting it to null instead of an empty string or use the ResetRegexPattern to clear it.