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
2549
UltraGrid, ValueList, Autocomplete causes FormatException
posted

Hi all,
I have an UltraGrid bound to a view. It is basically a mapping between a string and an int value so I have two visible columns.
For the int column I added a ValueList which I the attached to the column.

If I run the project the ValueList is shown, I can type (autocomplete) so it seems quite fine.

Unfortunately if I type something that does not exist in the ValueList I receive a FormatException.

I have set the Style of the column to DropDownValidate, assuming that this would fix it, but it didn't.

I know that I can set it to DropDownList, but I want the users to type more than one character for the autocompletion.

I also tried the BeforeExitEditMode event, but as expected the typing of the character itself causes the ValueList to fail (because the value does not exist).

How can I work around this? I want the user to type more than one character for the autocompletion and if he/she entered something invalid prompt the user with some options and not allow the cell to be left until this is done.

Any help is kindly appreciated,

best regards

Andy

Parents
  • 469350
    Verified Answer
    Offline posted

    Hi Andy,

    If I understand you correctly, then the column in your grid is of type int (Int32). And you have a ValueList on the column which is converting those integers into some user-friendly display text.

    In such a case, it is not possible for the user to enter a string into the column that does not exist on the list. When you type in something that does not exist on the list, the Value of the cell cannot be translated from the string into an integer, so the value of the cell becomes the string you typed. But since the field is an int, it cannot store a string, and so you will get an exception.

Reply Children
No Data