Click here to Skip to main content
15,885,985 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
good evening

i have a dropdownlist ddlcolor and a textbox txtcolor.


if i select a color in dropdownlist it should appear in the textbox txtcolor.

i have written the code

C#
protected void ddlcolor_SelectedIndexChanged(object sender, EventArgs e)
    {
        txtcolor.Text = ddlcolor.SelectedIndex;
    }


it is not working.

Please help me.
Posted
Comments
vijay__p 15-Apr-13 6:01am    
Check AutoPostback property in your Dropdown. It should be True.

C#
txtcolor.Text = ddlcolor.Text;


Also check AutoPostback property checkbox of your dropdownlist in designview
 
Share this answer
 
Comments
Member 9567873 15-Apr-13 6:09am    
it worked thank you very much
try this

C#
txtcolor.Text = ddlcolor.Text;


Good luck.
 
Share this answer
 
v2
Comments
Member 9567873 15-Apr-13 6:07am    
i have used the code but it not working.
Raje_ 15-Apr-13 6:09am    
Did you set AutoPostback property in your Dropdown to True?

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