I've got a form where users can input data and the behavior that I'm looking for is after the submit, the code behind writes to a database and returns a response of success to the page. I currently have this code working. The next item that I'd like to have happen is redirect after the successful message but I'd like to delay for 2 or 3 seconds allowing the user to see the success message before redirecting.
Behavior: Submit -> Show Success Message -> Delay 3 seconds -> Redirect
I'm currently developing this in VB; however I'm fine with examples in either VB or C#. This is a traditional web form.
I like this approach, although some of the already proposed are very good:
protected void Button1_Click(object sender, EventArgs e)
{
ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "success", "alert('Submitted Successfully.'); setInterval(function(){location.href='http://www.google.com';},3000);", true);
}
Good luck!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With