Click here to Skip to main content
15,912,457 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i want to post my drop down list value into the text box i binded the dropdownlist items using the sqlsource i am performing a three way selection after the third binding using sql source i want to show the value in the text box but the selection event is not firing the code for posting drop downlist value to the text box is

C#
protected void DropDownList3_SelectedIndexChanged(object sender, EventArgs e)
        {
            txtUrl.Text = DropDownList3.SelectedValue;
            
        }

i tried in the other way also like

C#
protected void DropDownList3_SelectedIndexChanged(object sender, EventArgs e)
        {
           
            txtUrl.Text = DropDownList3.SelectedItem.Value;
            
        }
Posted
Updated 12-Mar-14 4:53am
v2

Try this
DropDownList3 Autopostback = true
if it does not work send the source
 
Share this answer
 
v2
Hi,

Please on the AutoPostBack Property True for dropdownlist. But Your dropdownlist Binding code come in IsPostBack==false on PageLoad event.

Thanks
 
Share this answer
 
Give it a try, (I might be wrong)
C#
protected void DropDownList3_SelectedIndexChanged(object sender, EventArgs e)
        {
            if(!IsPostBack)
                txtUrl.Text = DropDownList3.SelectedValue;
            
        }

-KR
 
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