Hi,
We are experiencing performance issues related to the uses of UltraDropDownEditor set as a EditorComponent in a WinGrid. First i would like to mention that i've readed the WinGrid performance guide and specificaly the ValueLists section. This guide specify to make sure that the wingrid column data type is the same as the valuelist values, this seems to be the case.
Something seems to be going on with the text you type in a cell that is bound to dropdowneditor. If we create a dropdown with a value member typed as a string and a display typed as a string and we bound it to a column (which is string as well) everything works fine.
But when we do the same test with a editor which has a value member typed as a int (for example) , a display member typed string (so we see strings in our cells) bound as the editor of a column (which is typed as int (just like the editor value member) and we type alpha characters in the cell it get's slower. Somethign we also notcied is that if we type numeric characters it's as fast as the 'string exemple' as long as it stays below around 12 characters of lenght (we suspect him to 'detect' that it can no longer be a int and do his checks on a string instead.
Also please take note that if i take the 'int dropdowneditor' directly (not embedded but on the form), i can type alhpa characters at very good performance, so it seems related to some checks that the grid makes... Specificaly related to the cell datatype.
Note i have attached a sample projects to this post named as 'WindowsFormsApplication4', you can see that the first column performance are great and the other one is slower. This doesn't seems as bad in this sample, not sure why, but in our project with complex form and alot of binding the performance issue scale is far worst (our worst case is a grid with a 3 second delay for every characters typed) also if the typed character fit's with a element in the list, performance are very good, the problem arise when you mistype something that ain't in the list...
Hope you'll have all the info required to help me there!
Just to clarify, this sample is using UltraComboEditor as the EditorComponent property of the column. There is no such class as DropDownEditor, so I just wanted to clear up any confusion there.
What's happening in this sample is that when you type a character that is not on the list, the grid is trying to convert that string into an integer. This raises an exception because the conversion is impossible. The exception is caught and handled but it still causes a delay.
It works in the string column because there's no problem converting a string into a string.
The question is, what are you expecting to happen here? If your users are typing a string value into an integer column and there's no way for the grid to convert the string into an int, then there's really nothing the grid can do about that.
Is it valid in your application for a user to enter a string that is not on the list into an integer field? If so, what are you trying to do with that string? You cannot store it in the grid's DataSource, because an int field cannot hold a string.
You're are right about the control name, my mistake :)
I'm not sure why the editor would try to convert the string to a int, if my editor has it's display member column set on a string, it sounds like a normal thing to type text in the comboeditor. if what i type doesn't resolve to a item in the list, then it would simply not resolve a item and set the selecteditem as nulll (since none were resolved). Why would it try to convert what i type to a int?
We've noticed that if we type something that is not resolve as a displaymember value, it will fallback to a matching in the valuemember column. In my sample if you type '4' in the Column2 column in the grid, it fallback to 'Item #4', which to us is also weird... I'm not sure why if it's not resolved in the display member column it goes to the valuemember column. In our case the user type's in a employee number like '0123' but if he mistype and type '123' it will resolve to employee '0734' (since that employee has a id of 123 in the value member, which is the primarykey value in the database). Which will resolve to the wrong employee and most of all would not give ANY error, even if i limit to list...
Is there a way to disable this fallback matching? What we want here is that if the user type's '123' it tells the user that this item doesn't exist, it should be '0123'.
pmorin said:I'm not sure why the editor would try to convert the string to a int, if my editor has it's display member column set on a string, it sounds like a normal thing to type text in the comboeditor. if what i type doesn't resolve to a item in the list, then it would simply not resolve a item and set the selecteditem as nulll (since none were resolved). Why would it try to convert what i type to a int?
The DataType of the grid column is integer, so the value has to resolve to an integer (or null) at some point. When you type something that is not on the list, the value of the editor returns the string you typed. Otherwise, you would have to way to get that string.
If you want to resolve to null when the user types something that is not on the list, then I think you can achieve this using a DataFilter. But it might be easier for you to set the Style of the column to DropDownList so that the user cannot type anything that is not on the list.
pmorin said: We've noticed that if we type something that is not resolve as a displaymember value, it will fallback to a matching in the valuemember column. In my sample if you type '4' in the Column2 column in the grid, it fallback to 'Item #4', which to us is also weird... I'm not sure why if it's not resolved in the display member column it goes to the valuemember column. In our case the user type's in a employee number like '0123' but if he mistype and type '123' it will resolve to employee '0734' (since that employee has a id of 123 in the value member, which is the primarykey value in the database). Which will resolve to the wrong employee and most of all would not give ANY error, even if i limit to list... Is there a way to disable this fallback matching? What we want here is that if the user type's '123' it tells the user that this item doesn't exist, it should be '0123'.
If you set the Style of the column to DropDownList or use a DataFilter, it will solve both problems.
The reason this happens is that when you type in something that is not on the DisplayMember list (such as 4) the value of the editor falls back to the string you typed. So the Value of the cell becomes 4, which, of course matches a value on the list.