Get DropDown Values from Database Table
<p>I have a ASP:DropDown list which is populated by the following:</p>

<pre><code>public void Fill1()
{
    string connectionString = WebConfigurationManager.ConnectionStrings["CRM2Sage"].ConnectionString;
    using (SqlConnection _con = new SqlConnection(connectionString))
    using (SqlCommand cmd = new SqlCommand("SELECT * FROM Products", _con))
    {
        cmd.Connection.Open();

        SqlDataReader ddlValues;
        ddlValues = cmd.ExecuteReader();

        txtProduct.DataSource = ddlValues;
        txtProduct.DataValueField = "Description";
        txtProduct.DataTextField = "Description";
        txtProduct.DataBind();

        cmd.Connection.Close();
        cmd.Connection.Dispose();
    }
}
</code></pre>

<p>I need to call the <code>SalesPrice</code> from same table and based on the selected value in the drop down update a <code>ASP:TextBox</code> Field called <code>txtUnitAmount</code>.</p>

<p>I have tried writing it into the same function and it wont let me set the <code>.Text</code> value for the <code>ASP:TextBox</code>. Can any one suggest a way to achieve this?</p>

<p>Thanks to all for their help so far!</p>

<p>Cheers</p>

<p>Justin</p>

<p>Extra Code for Discussion</p>

<pre><code>public void Fill2()
    {
        string getProdValue = WebConfigurationManager.ConnectionStrings["CRM2Sage"].ConnectionString;
        using (SqlConnection _con = new SqlConnection(getProdValue))
        using (SqlCommand cmd = new SqlCommand("SELECT SalesPrice FROM Products WHERE Description = " + Request.Form["txtProduct"].ToString(), _con))
        {
            int getProdCost = (int)cmd.ExecuteScalar();
            txtUnitAmount.Text = getProdCost.ToString("###,###0.000");
        }           
    }
</code></pre>
