Hi,
I have a requirement where in a certain column user should be able to select some values from a list. My approach is to have a column that has a dropdownlist style. When popup I want a checkedlistbox to be displayed where user can select some of many items of type KeyValuePair(string, string).
In the cell itself I wand the list of selected keys to be stored, but in the front end i want the list of Values to be displayed.
Can this be done using UltraWinGrid?
Do you have a quickstart how I could achieve this?
Kind regards
Patrick
Hi Patrick,
Which part of this is giving you trouble?
I think you will need to use either UltraCombo or UltraComboEditor for this and set it up for mutli-select and then attach it to the column in the grid via the EditorComponent property.
Translating from DataValue to DisplayText is simply a matter of setting the correct ValueMember and DisplayMember (if you are binding) or the DataValue and DisplayText on each item (if you are not binding).
Hi Mike,
thanks for your reply. The approach using UltraComboEditor as EditorComponent of the cell is ok. Sorry I did not see the CheckedListSettings on my own. I needed your hint to look again an find it.
My requirement is not fully reached. I use the UltraComboEditor to display my list correctly, using ValueMember and Displaymember. The list is inherited of List<KeyValuePair<string,string>>.
After CloseUp or leaving the cell I can see the selected items value in my gridcell. This could be enough but I would prefer to see the keys instead of values. Is this possible.
Best solution was if I could have the list of values to be displayed in the grid and the list of keys to be synchronized to my underlaying business object.
Any ideas?
Kind RegardsPatrick
Patrick Jox said:After CloseUp or leaving the cell I can see the selected items value in my gridcell. This could be enough but I would prefer to see the keys instead of values. Is this possible.
If you want to see the key, then you should not be setting the DisplayMember to "Value". It should be set to "Key" or nothing at all. In the latter case, it will fall back to the ValueMember, which is already "Key" in your sample code.
optimal solution would be the following szenario.
In the ComboEditor there is a bound list with key and value. Value is displayed during dropdown. After closeup a list of values is displayed in grid cell. BUT the bound object has got the list of keys not values.
I think this is do be done manually during AfterCloseUp event. Right?
I'm a bit lost.
Patrick Jox said:In the ComboEditor there is a bound list with key and value. Value is displayed during dropdown. After closeup a list of values is displayed in grid cell. BUT the bound object has got the list of keys not values.
This is exactly what should happen if you follow my directions above. The whole point of having a DataValue and a DisplayText on the ValueList item is so you can display one thing to the users (DisplayText) but save something else to your data source (DataValue), like a key.
You do not need to handle any events for this.
sorry but the doing with comboeditor is ok and it works as expected. But I can not see how the grid cell could handle displaytext and datavalues.