Skip to content

Infragistics Community Forum / Web / Ultimate UI for ASP.NET Web Forms / How to Get WebDropDown Value Using Javascript…

How to Get WebDropDown Value Using Javascript…

New Discussion
Prabakaran G
Prabakaran G asked on Nov 3, 2016 5:48 AM

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.

 

Sign In to post a reply

Replies

  • 0
    Aneta Gicheva
    Aneta Gicheva answered on Nov 2, 2016 3:31 PM

    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

    • 0
      Prabakaran G
      Prabakaran G answered on Nov 3, 2016 5:48 AM

      Hi Aneta Gicheva,

      Thanks For your Kind replay…

      This one is what i exactly needed… This one solve my case. Thanks. 

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

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

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

  • You must be logged in to reply to this topic.
Discussion created by
Favorites
Replies
Created On
Last Post
Discussion created by
Prabakaran G
Favorites
0
Replies
2
Created On
Nov 03, 2016
Last Post
9 years, 11 months ago

Suggested Discussions

Created by

Created on

Nov 3, 2016 5:48 AM

Last activity on

Feb 19, 2026 7:34 AM