The DisplayAlert method adds a client script to the current executable page request. When you call Response.Redirect, ASP.NET issues an HTTP 301 redirect to the browser, so it launches a new page request where the registered client script no longer exists.
Since your code is running on the server side, there is no way to display the client side of the alert and redirect.
Also, displaying a JavaScript warning window can be confusing for a user workflow, an inline message would be much more preferable. Perhaps you could add a message to the session and display this on the request of the Default.aspx page.
protected void Save(..) {
Then, in the Default.aspx.cs code behind (or the common base class of the page, so that this can happen on any page or even on the main page):
protected void Page_Load(object sender, EventArgs e) { if(!string.IsNullOrEmpty((string)Session["StatusMessage"])) { string message = (string)Session["StatusMessage"];
The code is not verified, but should point in the right direction
roryf Apr 24 '09 at 8:34 2009-04-24 08:34
source share