Get the Dropdownlist text and value using Javascript from client side


I am encountering a problem about how to get the Dropdownlist text and value using Javascript from client side. I am using C# in Visual Studio 2005 and Javasript . The example codes are like:

( In this example code, I would like to access the text and value of the DropDownListReports in the run() function of Javascript. How can I do that? Any ideas? Thanks a lot. )

protected void Page_Load(object sender, EventArgs e)


             if (!Page.IsPostBack)




listItem = new ListItem();

                    listItem.Text = "aText";

                    listItem.Value = "aValue;





on the its source page:



asp:DropDownList ID="DropDownListReports" Width = '300' runat="server" > </asp:DropDownList>

<input id="btnSubmit" type="button" value="Click to view report on another browser" onclick="run()" TabIndex="3" />


script type="text/javascript">




     // ?????? for the example, please just using alert to show the pair of text and value for this dropdownlist.       Like:  alert(dropdownlist.text);


2/5/2007 9:40:16 PM 24353 articles. 2 followers. Follow

2 Replies

Similar Articles

[PageSpeed] 24

add the below code into your javascript function




Mark it as answered if it helps you

Haissam Abdul Malak
| Blog |
2/5/2007 10:50:58 PM

To get the value and the Text you could use it like this,  


var ddlReport = document.getElementById("<%=DropDownListReports.ClientID%>");
var Text = ddlReport.options[ddlReport.selectedIndex].text; 
var Value = ddlReport.options[ddlReport.selectedIndex].value; 




My Blog
If this post answers your question please mark it as Answered.
2/6/2007 9:58:41 AM

Web resources about - Get the Dropdownlist text and value using Javascript from client side -

Tag Synonyms - Stack Overflow
Q&A for professional and enthusiast programmers

Accidental entities - what about the UI?
This post is a follow-up to my previous blog post " Accidental entities - you don't need that identity ". In that post, we followed a consultant ...

Flash Builder Plug-in for SAP Netweaver Gateway - Adobe Labs
Search Navigation Labs Home Wiki Home Technologies Alchemy Blueprint Camera Profiles and DNG Profile Editor Cirrus ColdFusion 10 DNG Codec Fireworks ...

Air Astana - Join Now
Thank you for considering membership of Nomad Club – Kazakhstan’s first Frequent Flyer Program. You could soon be on your way to earning free ...

Languages -> C# Articles, Tutorials, Examples: ASP Alliance
.NET,ASP,ASP.NET,SQL,XML,HTML,ADO,ADO.NET,JavaScript,JScript,CSharp,VBScript and VB tutorials from AspAlliance.

Blog - Avisra
Avisra Web Development Home Blog Services Contact The Blog Latest Module Builder: How can we make it better? Sitefinity by Chris on July 2, 2013 ...

Online Booking Tool Support
This Online Booking Tool Support page might help you as you navigate through the process of booking travel through your OBT provided by CWT. ...

@Html and beyond
... ); } return string .Format( “{0}{1}” , me.Member.Name, id); } The Html building methods are quite simple. Building a dropdownlist for a ...

Top Ranked Articles
Top Ranked Articles - Free source code and tutorials for Software developers and Architects.; Updated: 23 Feb 2013

Unit Testing DateTime.Now Without Isolation
public virtual void SeedWithYearsSince(DropDownList list, int year){ for (int index = year; index

Resources last updated: 1/22/2016 10:54:04 PM