简体   繁体   中英

How to access the asp.net dropdownlist selected item value from javascript

How to access the asp.net dropdownlist selecteditem value from javascript? I have the following code here where i want to access the dropdownlist selecteditem value in the javascript , and pass that value as a query string to another page

      function Example()
                 {

                     var e =  $find("ExampleDropDownList");
                     var strUser = e.options[e.selectedIndex].value;
                     alert(strUser);
                     window.radopen("ExampleDetail.aspx?Id=" + strUser, "Dailog");
                     return false;
                }

 <telerik:RadComboBox ID="ExampleDropDownList" runat="server" >
    </telerik:RadComboBox>

ASP.Net Controls always render back into plain HTML Controls. When using javascript you can call the item exactly as you normaly would a dropdown. The dropdown list will have the ID of your RadComboBox.

var myDropDown = document.getElementById('ExampleDropDownList');

and you will have access to your dropdown list.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM