Link to home
Create AccountLog in
Avatar of searchsanjaysharma
searchsanjaysharma

asked on

How to redirect the page to a link in this kind of situation,

I have html page. It reads the paremeter and transfer the control to .aspx page.
Once the data is saved, i want the message should come as
Record Submitted Successfully and then the page should be directed to index.aspx

The following code doesn;t gives the desired output.

if (!IsPostBack)
        {
            try
            {
                string sname = Request.Form["NAME"].ToString();
                string fname = Request.Form["FNAME"].ToString();
                string address = Request.Form["ADDRESS"].ToString();
                string landline = Request.Form["LANDLINENO"].ToString();
                string contactno = Request.Form["CONTACTNO"].ToString();
                string email = Request.Form["EMAIL"].ToString();
                string academic = Request.Form["ACADEMIC"].ToString();
                string sports = Request.Form["SPORTS"].ToString();
                string activity = Request.Form["ACTIVITY"].ToString();
                string dtype = Request.Form["DType"].ToString(); ;
                string course = "";
                if (dtype == "Grad")
                {
                    course = Request.Form["GCOURSE"].ToString();
                }
                else if (dtype == "PostGrad")
                {
                    course = Request.Form["PGCOURSE"].ToString();
                }
                else
                {
                    course = Request.Form["DCOURSE"].ToString();
                }
                string frm = Request.Form["FROMWHERE"].ToString();
                if (frm == "Others")
                {
                    frm = Request.Form["OTHER1"].ToString();
                }
                string edu = Request.Form["Edu"].ToString();
                string Edu = "";
                if (edu == "Any Other")
                {
                    Edu = Request.Form["OTHER2"].ToString();
                }
                //procedure to save data
                Response.Write("<script>alert('Record saved successfully')</script>");
                Response.Redirect("http://www.cu.com/")

            }
            catch (Exception ee)
            {
                Response.Write(ee.ToString());
            }
        }
    }
SOLUTION
Avatar of deviprasadg
deviprasadg
Flag of India image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
SOLUTION
Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER CERTIFIED SOLUTION
Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
Avatar of searchsanjaysharma
searchsanjaysharma

ASKER

tx