How to assign the selected value of Drop down to text box
<p>I'm trying to assign the selected value in the drop down to text box when ever I hit a button. I'm not able to see the selected value in the <code>TextBox</code>. Can someone please let me know what am I missing?</p>

<p>My code is as follows:</p>

<pre><code>public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {                       

    }

    protected void Button1_Click1(object sender, EventArgs e)
    {

        string strConn = "Initial Catalog=NavigateV6;Data Source=SVUSRYE-SQL3D1;User ID=dopis_user;Password=dopis_password;Persist Security Info=True;MultipleActiveResultSets=True";
        SqlConnection mycn = new SqlConnection(strConn);
        DataSet ds = new DataSet();
        SqlDataAdapter myda = new SqlDataAdapter("Select accountid FROM trn_account ", mycn);
        myda.Fill(ds);
        DDL.DataSource = ds;
        DDL.DataTextField = "AccountID";
        DDL.DataValueField = "AccountID";
        DDL.DataBind();

    }



    protected void DDL_SelectedIndexChanged(Object sender, EventArgs e)
    {
        var selectedValue = ((DropDownList)sender).SelectedValue;
        if (!string.IsNullOrEmpty(TextBox1.Text))
            TextBox1.Text = selectedValue;

    }
}
</code></pre>

<p>ASPX:</p>

<pre class="lang-xml prettyprint-override"><code>&lt;asp:DropDownList ID="DDL" runat="server" AutoPostBack="True" OnSelectedIndexChanged = " DDL_SelectedIndexChanged" &gt;

    &lt;/asp:DropDownList&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
    &lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
    &lt;asp:Button ID="Button1" runat="server" onclick="Button1_Click1" 
        Text="sumbit" /&gt;
    &lt;asp:TextBox ID="TextBox1" runat="server"&gt;&lt;/asp:TextBox&gt;
    &lt;br /&gt;
&lt;/asp:Content&gt;
</code></pre>
