Click here to Skip to main content
15,893,622 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
 there is a dropdownlist
 
<asp:DropDownList ID="ddlFranchise" runat="server" >
<asp:ListItem>Canada</asp:ListItem> 
<asp:ListItem>India</asp:ListItem>
<asp:ListItem>USA</asp:ListItem> 
</asp:DropDownList>
 
 
 
these  show  in label like
 
Canada(Label1) :
 
India (Label2) :
 
USA (Label3) :


What I have tried:

Nothing
Posted
Updated 16-Jan-17 3:14am
v2
Comments
Afzaal Ahmad Zeeshan 12-Jan-17 4:51am    
Where are the labels? How are you building the interface.
Ali Majed HA 12-Jan-17 5:05am    
What do you mean by "I have tried NOTHING" ?
Sunasara Imdadhusen 12-Jan-17 6:08am    
Nothing means WHAT?

Hi
I will assume you have worked with JQuery before. If you have not please Google it. what you can do is use the ID/Name of your label to display the value from the drop down.

You can get a value from the dropdown as follows:
JavaScript
$("#ddlFranchise").val()


You can then set this selected value to any of your labels as follows:
JavaScript
$("#label1").text($("#ddlFranchise").val())


I hope this helps your.

Regards
 
Share this answer
 
1] .aspx code:-
<asp:DropDownList ID="ddlFranchise" runat="server" OnSelectedIndexChanged="ddlFranchise_SelectedIndexChanged" AutoPostBack="true" >
<asp:ListItem>Canada</asp:ListItem> 
<asp:ListItem>India</asp:ListItem>
<asp:ListItem>USA</asp:ListItem> 
</asp:DropDownList>

2] Code Behind :-
C#
protected void ddlFranchise_SelectedIndexChanged(object sender, EventArgs e)
{
Label1.Text = ddlFranchise.SelectedItem.Text;
}


Hope the above will help.
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900