Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
210
How to Get WebDropDown Value Using Javascript...
posted

Hi Team,

I am using IG v14.2. In the WebDropDown control i need to get the value and text using javascript function. When i get the Control in client side means i will only get the WebDropDown Text. I need value also.

For Ex:-

Value  Text

  1      Test-1

  2      Test-2

When i use like this means "$find("WDD_FromCustomers").get_currentValue();" i get only the text. But i need value also.

I am not using the Controls Client side events like "WebDropDown1_SelectionChanged" etc...

Please let me know your comments.

 

Parents
  • 435
    Verified Answer
    posted

    Hello Prabakaran,

    Thank you for using our community!

    I investigated your case and it’s going to be easily to achieve the required functionality using our client-side events. I am not sure what is your scenario and does it allow you to use our client-side events. If it does, my suggestion is to use SelectionChanged event to get the value of the currently selected element.

    function WebDropDown1_SelectionChanged(sender) {

                var item = sender.get_items().get_item(sender.get_selectedItemIndex());

                var value = item.get_value();

                var text = item.get_text();

            }

    Here the sender is a reference to the WebDropDown and you could use the console to see all methods and properties. You could see the attached file and investigate the code.

    Furthermore, if you don’t want to use our client-side events, you could get the value of the currently selected element using the following code:

    var control = $find("<%=this.WebDropDown1.ClientID %>");

                    var value = control.get_selectedItem().get_value();

                    var text = control.get_selectedItem().get_text();

    If my suggestions aren’t working for your scenario, please send me detailed information for your scenario. If you send me an isolated code sample or modify my sample, I will be able to provide a better support. Do not hesitate to contact us if you have more questions regarding this issue.

    Regards,

    Aneta Gicheva,

    Infragistics

    WebDropDownGetValueClientSide.zip
Reply Children
No Data