Hello,
Need help in dropdownlist selectedindex not changing situation.
In my asp.net page, I have four dropdownlists.Only the first one can be bound in pageload event (in if(!ispostback) condition).All the others are loaded only after the first dropdownlist value selected.
My problem is that the fourth dropdownlist selectedindex not changing which will bound data after the selection of third dropdownlist.
I feel this as a strange problem.
Sarath.
Sir I have tried this, but didnt solve. In 4th dropdownlist, every time selectedindex is 1 after postback, even after we change selection. viewstate is set true.
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
cf.Load_Dropdown(Drp_Mix, " SELECT cm.Mix_ID, cm.Mix_Name FROM CP_Mix cm ORDER BY cm.Mix_Name ", "Mix_Name", "Mix_ID");
}
}
protected void Drp_Mix_SelectedIndexChanged(object sender, EventArgs e)
{
cf.Load_Dropdown(Drp_Sale_product, " SELECT distinct cast(gpm.N_Prd_Id AS INT) AS N_Prd_Id, gpm.V_Prd_Name,V_Prd_Name+'--'+CAST(isnull(F_Prd_Tpi_Single,'') AS VARCHAR(50))+'--'+ CAST(isnull(F_Prd_Tpi_Double,'') AS VARCHAR(50)) +'--'+CAST(cast(gpm.N_Prd_Id AS INT) AS VARCHAR(30)) AS prd " +
" FROM ProductMst gpm where gpm.V_Prd_Name LIKE '%" + Drp_Mix.SelectedItem.Text + "%' AND cast(gpm.N_Prd_Id AS INT) > 199999 AND V_Prd_Del_Flg='N' ORDER BY gpm.V_Prd_Name", "prd", "N_Prd_Id");
}
protected void Drp_Sale_product_SelectedIndexChanged(object sender, EventArgs e)
{
Drp_Purch.Items.Clear();
cf.Load_Dropdown(Drp_Purch, " SELECT distinct Comp_Prd_Id,Comp_Material FROM Components gc WHERE Comp_Prd_Id='" + Drp_Sale_product.SelectedItem.Value + "'AND Comp_Material!='" + Drp_Sale_product.SelectedItem.Value + "' ", "Comp_Material", "Comp_Prd_Id");
Drp_Purch.Items.Insert(0, "--SELECT--");
}
protected void Drp_Purch_SelectedIndexChanged(object sender, EventArgs e)
{
string s=Drp_Purch.SelectedIndex.ToString();
}