Wednesday, December 28, 2011

How to get Dropdown Selected value using javascript in ASP.NET?

Posted by Rahul Kharde at 9:56 PM
I have dropdownlist box, when I change the value in the dropdownlist box javascript function get fired. And it will shows the selected value in the popup box.


So first add an aspx page into your project & paste the below code for asp:dropdownlist under the form div section:

<asp:DropDownList ID="DropDownList1" runat="server" OnChange="javascript:GetDropDownValue()">

<asp:ListItem Value="1">C#</asp:ListItem>

<asp:ListItem Value="2">ASP</asp:ListItem>

<asp:ListItem Value="3">WPF</asp:ListItem>

<asp:ListItem Value="4">WCF</asp:ListItem>

<asp:ListItem Value="5">C++</asp:ListItem>



Add javascript function in head tag

function GetDropDownValue()


var IndexValue = document.getElementById('<%=DropDownList1.ClientID %>').selectedIndex;

var SelectedVal = document.getElementById('<%=DropDownList1.ClientID %>').options[IndexValue].text;





Download Code Here….

If you enjoyed this post and wish to be informed whenever a new post is published, then make sure you subscribe to my regular Email Updates. Subscribe Now!

Kindly Bookmark and Share it:



youngsterblog on June 27, 2012 at 8:33 AM said...

Thanks for posted this code. this code works for me.

Fritz John Marajas on February 14, 2015 at 11:56 PM said...

Experience the thrill of outdoor laser tag skirmish in a new and exciting way.
It’s an ideal activity for kids and teenagers birthday parties!
Our Crew will arrive at least 15 minutes before your party starts to establish
the playing area and set up the equipment.

laser tag

Jagna Co Kalani on November 3, 2017 at 6:42 AM said...

This is an amazing blog,it gives very helpful messages to us.Besides that Wisen has established as Best Dot Net Training in Chennai. or learn thru ASP.NET Online Training . Nowadays Dot Net has tons of job opportunities on various vertical industry.

Have any question? Feel Free To Post Below:


Popular Posts

Recent Comments

© 2011. All Rights Reserved | Help to understand .Net | Template by Blogger Widgets

Home | About | Top