hi all - i am using the code below to get the selected value of a dropdownlist to pass as a paramter to the functions as shown below. however, the first time the page loads, the value of the parameter @Company_Id is NULL because ddlCompanies.SelectedValue
also seems to be NULL.
bt when i change the value of the company from dropdownlist, it works but it doesn't work the first time the page loads. any idea what is happening? thanks in advance!!
SqlConnection conn = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["NNConnectionString"].ConnectionString);
conn.Open();
SqlCommand cmd = new SqlCommand("SELECT Description FROM [ufn_Get_Stats](@Company_ID)", conn);
cmd.Parameters.AddWithValue("Company_ID", ddlCompanies.SelectedValue);
var obj = cmd.ExecuteScalar();
if (obj != null)
{
...
Go to the complete details ...