Hi,
In my web form, i have 2 drop downlist controls. eg. dropdown1 and dropdown2. I will change the dropdownlist1 item, consequently selectedindexch anged event fires and reloads the dropdownlist2 items. And i have another button also in order to get the result based on the dropdown1 and dropdown2.
Lets say for example, i have a list of countries in dropdown1 and a list of states in dropdown2. I selected "India" in dropdown1 and correspondingly "Tamilnadu" in dropdown2. And then click a button which calls the dataset based on dropdown1 and dropdown2.
The problem i face here is, whenever i click on the button to load the dataset, dropdown1 value remains the same as the dataset is not called again, whereas the dropdown2 value changes to the first one as it gets called automatically during postback.
For your information, I have loaded both the lists in the page load using (!IsPostback) property.
My coding is as follows:
Please give me a solution for this.. Mail me @
<email removed>
Thanks in advance..
Mani
In my web form, i have 2 drop downlist controls. eg. dropdown1 and dropdown2. I will change the dropdownlist1 item, consequently selectedindexch anged event fires and reloads the dropdownlist2 items. And i have another button also in order to get the result based on the dropdown1 and dropdown2.
Lets say for example, i have a list of countries in dropdown1 and a list of states in dropdown2. I selected "India" in dropdown1 and correspondingly "Tamilnadu" in dropdown2. And then click a button which calls the dataset based on dropdown1 and dropdown2.
The problem i face here is, whenever i click on the button to load the dataset, dropdown1 value remains the same as the dataset is not called again, whereas the dropdown2 value changes to the first one as it gets called automatically during postback.
For your information, I have loaded both the lists in the page load using (!IsPostback) property.
My coding is as follows:
Code:
protected void Page_Load(object sender, EventArgs e)
{
try
{
if (Session["sesUserName"] == null)
{
Response.Redirect("sessionExpr.aspx", false);
}
else
{
lblStatus.Visible = false;
pnlEvaluate.Visible = false;
if (!IsPostBack)
{
fnLoadDropDown1();
fnLoadDropdown2();
}
}
}
catch (Exception ex)
{
throw ex;
}
}
public void fnLoadDropDown1()
{
dsLoadDD1 = objWebRef.fnLoadOnlineTest();
if (dsLoadDD1.Tables[0].Rows.Count > 0)
{
ddTestTitle.DataTextField = "vchTestTitle";
ddTestTitle.DataValueField = "intTestID";
ddTestTitle.DataSource = dsLoadDD1.Tables[0];
ddTestTitle.DataBind();
}
}
public void fnLoadDropDown2()
{
dsLoadDD2 = objWebRef.fnLoadOnlineTest();
if (dsLoadDD2.Tables[0].Rows.Count > 0)
{
ddUser.DataTextField = "vchUser";
ddUser.DataValueField = "intUserID";
ddUser.DataSource = dsLoadDD2.Tables[0];
ddUser.DataBind();
}
}
protected void ddTestTitle_SelectedIndexChanged(object sender, EventArgs e)
{
try
{
fnLoadUsersforTest();
}
catch (Exception ex)
{
throw ex;
}
}
<email removed>
Thanks in advance..
Mani
Comment