ComboBox and JavaScript

Posted by: d-thoma on 10 September 2017, 11:27 am EST

  • Posted 10 September 2017, 11:27 am EST

    Somewhat new to JavaScript, hopefully this is simple.

    Ultimately what I am after is after the item is selected in a ComboBox we run an "Query" back to the server and return data to the page and fill in some text boxs (well some componentone maskedits in this case).

    I have narrowed it down to the "OnClientBlur" and "OnClientTextChanged" functions, but I have no idea on how to access the value the "ComboBox1" value/text/selectedindex.

     The only thing I have been able to figure out is if I do:

    document.getElementById("ct100_ContentPlaceHolder1_TextBox1").value = "xyz";

     I can fill in a text box with "xyz".

    I just need the "how" to get the information out of the combobox1 ...then I will work on the ajax part of the script. 

    Can anyone give me a good place to start learning javascript as well?

     Thank you for your help.

  • Replied 10 September 2017, 11:27 am EST

    Hi Thoma,


    Thank you for using C1ComboBox. Could you please look at the sample code I provided to see if this sovled your problem.


    <script type="text/javascript" id="ComponentOneClientScript1">
    function c1ComboBox_OnClientSelectedIndexChanged(sender, arg) {
    var selectedItem = sender.get_selectedItem();
    var index = selectedItem.get_index();
    var text = selectedItem.get_text();
    var value = selectedItem.get_value();
    </script></pre> P.S.:</pre>For learning javascript, I think you could go to this site to see if there is something you need.</pre> </pre>For ajax, you could have a look at Manning,</pre> </pre> </pre>
Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels