Link to home
Start Free TrialLog in
Avatar of jordanhelen
jordanhelenFlag for United States of America

asked on

drop list values

I have a web page with a drop list that have values I want to take the value the user selects and put it in a lable using vb.net
ASKER CERTIFIED SOLUTION
Avatar of Rajkumar Gs
Rajkumar Gs
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
If yes, remember to enable AutoPostBack property of Dropdownlist. and write code in SelectedIndexChanged event as shown above.

Raj
You can also use jquery something like so to get the value:

var selected = $("#dropdownidhere option:selected").text();

and to set the label:

$('#<%= labelidhere.ClientID %>').text(selected);

something like so:
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js" type="text/javascript"></script>

<script type="text/javascript">
$(document).ready(function() {
var selected = $("#dropdownidhere option:selected").text();
            if(selected != "") 
            {
             $('#<%= labelidhere.ClientID %>').text(selected);
            }
});
</script>

Open in new window