Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
585
How to avoid "Value in the editor is not valid" infinite loop
posted

(This seems somewhat related to https://ko.infragistics.com/community/forums/f/ultimate-ui-for-windows-forms/56907/infinite-loop-error-message-on-celldataerror.)

We have an UltraGrid with FilterUIType.FilterRow, and some columns that can raise data errors (in this case, a DateTime column). We also have a feature where, if you're inside the filter row, type in a filter, and hit return, the first matching row gets opened as a form.

Unfortunately, this combination seems to cause an infinite loop, something like:

1. the user types, say, '08/24' in a date field. That is, they omit the year.

2. then they hit 'return'.

3. this opens a form, causing the filter cell to lose focus, which causes…

4. a dialog to pop up saying "Value in the editor is not valid"

5. then you hit OK on it, but that once again loses focus on the filter cell, so the dialog pops up again

 

Now, I've found that I can use the CellDataError event to get notified of the error in the filter cell. But what I really want is for my code that opens a form to know in advance that there's a data error, and to just not proceed at all. I.e., to ask the entire filter row whether there's any cell whose current value isn't valid.

I see that there's a Grid.DisplayLayout.Rows.FilterRow.DataErrorInfoResolved.HasErrors, but it's false. It seems DataErrorInfo is only used when manually filled by me.

Can I explicitly do something like a hypothetical Grid.DisplayLayout.Rows.FilterRow.ValidateAll()?