problem in calling dropdown ....through if-else

Aug 16 2010 5:08 AM
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....

Answers (1)