asp.net: redirect to page after confirmation?
How do I redirect the page once the user has seen the confirmation page?
I am using asp.net 3.5, it's not showing me a message instead it's just redirecting to the default page. I want to see the message and once the user has clicked 'ok' then it redirects to another page.
ScriptManager.RegisterClientScriptBlock(this, this.GetType(), key, "jAlert('" + msg + "','" + title + "');", true);
Response.Redirect("default.aspx", false);
Pass the page redirect as part of the Javascript, rather than as a server-side redirect:
var redirectLocation = Page.ResolveUrl("default.aspx");
var title = "Message Title";
var message = "Detail of the message";
var scriptTemplate = "jAlert('{0}','{1}'); location.href='{2}'";
var script = string.Format(scriptTemplate, message, title, redirectLocation);
ScriptManager.RegisterClientScriptBlock(this, this.GetType(), key, script, true);
I've broken it out like that to hopefully make my answer easier to read, plus it makes for code that's easier to maintain =)
链接地址: http://www.djcxy.com/p/71534.html上一篇: ASP.NET MVC3 Ajax.ActionLink
下一篇: asp.net:确认后重定向到页面?