Hi All,
I'm using the selectedindexchanged of one of my Drop down lists to populate another ddl.
It's populating the ddl with with the data i want. However when i want to use the newly populated ddl value/text for a insert/update. It only updates/inserts as a blank value.
i know this has something to do with my Data Biding, but i can't seem to get the ddl to bind.
Code Used to populate the ddl:
protected void RadDropDownList3_SelectedIndexChanged(object sender, DropDownListEventArgs e)
{
RadDropDownList DropDownList3 = ((RadDropDownList)((RadDropDownList)sender).Parent.FindControl("RadDropDownList3"));
RadDropDownList DropDownList2 = ((RadDropDownList)((RadDropDownList)sender).Parent.FindControl("RadDropDownList2"));
DropDownList2.DataSourceID = null;
DropDownList2.DataSource = null;
DropDownList2.Items.Clear();
string prinparam = DropDownList3.SelectedText;
string strqry = string.Format(@"select distinct locationfullname from D_Location where DivisionName = '" + prinparam + "' ORDER BY 1 ;", prinparam);
DataTable dt = new DataTable();
using (strcon)
{
var command = new SqlCommand(strqry, strcon);
SqlDataAdapter da = new SqlDataAdapter(strqry, strcon);
strcon.Open();
DataSet ds = new DataSet();
da.Fill(dt);
DropDownList2.Items.Clear();
foreach (DataRow dr in dt.Rows)
{
DropDownList2.Items.Add(dr[0].ToString());
}
}
DropDownList2.DataBind();
DropDownList2.SelectedValue = DropDownList2.SelectedText;
}