Hi
In my grid one column is a combo dropdown. The display member is name(string) and the value member is number(int). i get the data from database.
I can type both name(string) and number(int) in this column and save it. I used celldataerror and before cell update events to achieve this.
My problem is if i type a number and if that exists as in database as value member( since it is a number(int)), the ultracombo is displaying the respective display member of that value member.
But i dont want the ultracombo to display the display member of that value member as i want to save that number as a string in the displymember filed as name.
Can anyone tell me how to remove the automatic display of the display member if we type the value member in ultracombo???
Thanks in advance
Navi
Hi everyone
I found work around solution to the above mentioned problem.
We can use ultragrid_BeforeExitEditMode event and solve the above problem
In this event first we will compare the typed name to all the names present in the database. If that name is present dont do anything, else save it to database. :)
navi519 said:In this event first we will compare the typed name to all the names present in the database. If that name is present dont do anything, else save it to database. :)
If the name is not present, you probably don't want to just automatically save it to the database, do you? What if the user types in a number that is not valid?
It seems to me that what you need to do is find the item on the list. You can do this easily enough by calling cell.ValueListResolved.GetText(...). This will return you an index of the item on the list that matches the value you passed in (or -1 if there is no match) and also return you the text of that item. Then you can set the cell.EditorResolved.Text to the text returned. This way, i's as if the user typed in the text instead of the value and the grid can take it from there.