Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get alert message before redirect a page

I'm using vs 2010. I need to display the message to user and redirect the page.

I use the below line.

ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", "<script> alert('User details saved sucessfully');window.open('frmDisplayUsers.aspx');</script>", true);

But I didn't get the alert message and the page was directly redirected.

How to get alert message?

like image 234
Pooja Avatar asked Dec 20 '11 04:12

Pooja


People also ask

How do I get alert messages after redirecting a page?

For displaying alert message after redirection you may use Session or QueryString and on page Load check if the Session or QueryString is not empty then display alert message.

How to show alert message after response redirect in asp net?

The JavaScript function first displays the alert message box using the JavaScript window onload event, and then redirects the user to the specified page using the window location method.

How can I show alert in PHP?

PHP doesn't support alert message box because it is a server-side language but you can use JavaScript code within the PHP body to alert the message box on the screen.


1 Answers

Your code is opening window but your asking for a redirect, below is an example of a redirect:

ScriptManager.RegisterStartupScript(this, this.GetType(), 
"alert", 
"alert('User details saved sucessfully');window.location ='frmDisplayUsers.aspx';", 
true);
like image 150
rick schott Avatar answered Oct 26 '22 11:10

rick schott