Click here to Skip to main content
12,252,418 members (62,662 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: C# ASP.NET Javascript
Hi all, i have a quick question. I have a webpage that has an asp:Dropdownlist control. How can i get the SelectedValue of this dropdownlist in my javascript?

e.g: var value = document.GetElementById(DDL).Value
Posted 20-Sep-12 3:44am
Ruwaldo735
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 3

var ddl = document.getElementById("<%=DDL.ClientID%>");
var SelVal = ddl.options[ddl.selectedIndex].text;
alert(SelVal); //SelVal is the selected Value
Reference
1. get selectedvalue of dropdownlist using javascript in asp.net[^]
2. Get selected value of asp:dropdownlist in javascript:[^]
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

I got the solution here...
  Permalink  
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

Try below code:
var e = document.getElementById("ddlLocation");  
var selectedLocation = e.options[e.selectedIndex].value; 
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web01 | 2.8.160426.1 | Last Updated 20 Sep 2012
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100