hi guys
protected void DropDownList3_SelectedIndexChanged(object sender, EventArgs e)
{
DropDownList4.Items.Add(new ListItem("--Select Project Name--", ""));
DropDownList4.AppendDataBoundItems = true;
String strConnString = ConfigurationManager.ConnectionStrings["conString"].ConnectionString;
String strQuery = "Select * from " + DropDownList3.SelectedItem + " ";
SqlConnection con = new SqlConnection(strConnString);
SqlCommand cmd = new SqlCommand();
cmd.CommandType = CommandType.Text;
cmd.CommandText = strQuery;
cmd.Connection = con;
try
{
con.Open();
DropDownList4.DataSource = cmd.ExecuteReader();
DropDownList4.DataTextField = "ProjectName";
DropDownList4.DataValueField = "project_name";
DropDownList4.DataBind();
if (DropDownList4.Items.Count > 1)
{
DropDownList4.Enabled = true;
}
else
{
DropDownList4.Enabled = false;
}
}
catch (Exception ex)
{
throw ex;
}
finally
{
con.Close();
con.Dispose();
}
I am using this code to populate drodownlist4 on the basis of dropdownlist3 selection. but it is not working
i am not getting any error as well as not getting any value in dropdownlist 4
now plz help me.....