i want to do is if drop down list selected value will be "electrical" then page redirect to the elec.aspx.
protected void apply_Click(object sender, EventArgs e)
{
string DEPT = "";
library lib = new library();
string strdepartment_name = ddrdepartment.SelectedValue.Trim();
DataTable dtdeptname = new DataTable();
dtdeptname = lib.Getdeptname(strdepartment_name);
DEPT = lib.Getdeptname(strdepartment_name);
if (DEPT == "CIVIL")
{
Response.Redirect("CIVIL.aspx");
}
else if (DEPT == "ELECTRICAL")
{
Response.Redirect("ELEC.aspx");
}
else
{
Response.Redirect("MECH.aspx");
}
}
please someone help me ...i m not getting properly....
sham sumanPosted Aug 16, 2010, 5:53 AM
First you check for the file path. Is it getting the path of the file correct or not.
Then check DEPT string is getting correct value or not. If any space is there, use trim method with string variable like
Dept.Trim;
your code is correct only check for file path and correct value from the DataTable.
You can see this...
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
{
string DEPT = null;
DEPT = DropDownList1.SelectedItem.Text.Trim();
if (DEPT == "CIVIL")
{
Response.Redirect("CIVIL.aspx");
}
else if (DEPT == "ELECTRICAL")
{
Response.Redirect("ELEC.aspx");
}
else
{
Response.Redirect("MECH.aspx");
}
}
Regards,
Shambhu