Upon Button Click Display Pop-Up for Certain Time and then Redirect Page - ASP.NET

1.2k views Asked by At

I have a form. Upon clicking a submit button, I want to display a message (say: ""Submitted Successfully) as a pop-up. The pop-up must stay for about 3 seconds and after that I want to reload/redirect the page.

I am aware that I can achieve this using jQuery. But I want to know if there is a way to achieve this through asp.net/C# which I can write in the cs file of the aspx page.

How do I achieve this?

Below is the button-click method I have written currently. Notice the code: thread.sleep(3000) - during this 3 second delay I want to show a pop-up.

protected void btnSubmit_Click(object sender, EventArgs e)
{
    SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString);
    con.Open();

    SqlCommand cmd = new SqlCommand("insert into Demo_UserInfo values (@UserID, 'FX1234', (select ReleaseID from Demo_ReleaseInfo where ProductName='asd'), 0)", con);

    cmd.Parameters.AddWithValue("@UserID", txtUserID.Text);

    cmd.ExecuteNonQuery();
    con.Close();        

    Thread.Sleep(3000);
    Response.Redirect("~/Admin/MapReleaseItem.aspx");
}
1

There are 1 answers

0
Akshay Randive On BEST ANSWER

you can put a loader instead This article can help you