Click here to Skip to main content
15,892,674 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have a project where i want that if a user selects a value in the dropdownlist .. it must be shown in the label but the onselectedindexchanged method is not firing the values but if i click on any button present the same page then the value is being shown in the label..

the desire output is that the onselectedindexchanged must fire the value on its own

here's my code

 protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
{

    string sdr= dropdownlist1.selectedvalue;
    label1.text= "Hi"+sdr;

 }


any help is appreciated.

Thnk u
Posted
Comments
Mac12334 29-May-13 8:04am    
Try AutoPostBack="true"

1 solution

Set the tag of AutoPostBack to true.
C#
AutoPostBack="true"
will solve the issue.

Good luck,
OI
 
Share this answer
 
Comments
Aarti Meswania 29-May-13 8:02am    
right 5!+ :)
Orcun Iyigun 29-May-13 8:08am    
Thank you Aarti.
Aarti Meswania 29-May-13 8:10am    
Welcome! :)
Swayam231 29-May-13 8:05am    
Thanks Orcun Iyigun.. Works fine now!! :)
Orcun Iyigun 29-May-13 8:08am    
You are welcome.

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