Hi
I am using inartistic webedropdown and I want to validate all the drop down selected Item text in Javascript . I did $find('<%=dd.ClientID %>').get_selectedItems() but unable to get the selected text of the Item in javascript . I have set MultipleSelection = false and If user manually delete the selected text in the dropdown I should get Text as null in Javascript . Please provide me a solution for this issue .
Hello Sujay,
You can achieve this using the following code:
var value = $find('<%=dd.ClientID %>').get_currentValue();
Let me know if this helps.
Hi Sujay,
If you have any further questions, please feel free to contact me.
How can I assign a value to a webdropdown in javascript?
or select a value from the list, this is bind to sqldatasource.
in the codebehind I solved using
webdropdown.ValueField="01";
webdropdown.TextField="01";
But I need a solution for javascript.
thank you.
Hi marenas,
You can do this using the following code:
var ddl = $find("WebDropDown1");var value = ddl.get_items().getItem(3).get_text();ddl.get_items().getItem(3).set_selected(true);ddl.set_currentValue(value);
Hi Nikolay,
I'm having the same problem and when I try your soution it only updating the texbox and the highlighted item is still the previous selected.
kind regards
Peter Tabangan
Hello Peter,
I would suggest you try the select() method of the dropdown item: http://help.infragistics.com/Doc/ASPNET/2013.1/CLR4.0/?page=WebDropDown~Infragistics.Web.UI.DropDownItem~select.html
ddl.get_items().getItem(3).select();
This should set the item as selected.