I have several WebDropDowns on my page. When the user clicks the dropdown to view the list, I need to display each item's text. When they select an item, I need to display the selected value, rather than the selected text, as the selected item in the dropdown list. Is this possible?
Hello,
In order to see the changes you could handle the same event like
function WebDropDown1_SelectionChanged(sender, eventArgs) {
selItem = sender.get_selectedItem();
selItemVal = sender.get_selectedItem().get_value();
selItem.set_text(selItemVal); }
However, this will result in closing the dropdown. The values will be displayed upon opening the dropdown again. It is also possible to programmatically close/reopen the dropdown, if this is not the expected for the user to make the additional interaction. What is more, the dropdown closing on selection is the default behavior which happens automatically unless you have EnableClosingDropDownOnSelect set to false.
Selecting the value is not the problem. I need to DISPLAY the VALUE instead of the TEXT. Here is an example of what I need:
When they click to open the dropdown list, the following options appear:
Value Text
1 Option One
2 Option Two
3 Option three
When they click on 'Option One', I need '1' to display in the dropdown list.
Adding the following didn't seem to do anything: //change the item's text selItem.set_text(selItemVal);
I tried adding that above and below sender.set_currentValue(selItemVal), and I tried removing sender.set_currentValue(selItemVal), either way the display did not change.
If you would like to change only the current value for the drop down to match the selected item’s value, it is possible to handle the client side SelectionChanged event and use the following: function WebDropDown1_SelectionChanged(sender, eventArgs) {
//change the selected text
sender.set_currentValue(selItemVal)} <ig:WebDropDown> <ClientEvents SelectionChanged="WebDropDown1_SelectionChanged" /> </ig:WebDropDown>
If you would like to manipulate each item’s text and change it upon user interaction with its value, it is possible to add the following in the above event as well //change the item's text selItem.set_text(selItemVal);
Additionally you could reference some of the already existing topics regarding this or similar matters:http://ko.infragistics.com/community/forums/t/71997.aspxhttp://ko.infragistics.com/community/forums/t/65595.aspxhttp://ko.infragistics.com/community/forums/t/76242.aspx