开发者

How to redirect to a different page from a javascript alert box in a .net application?

开发者 https://www.devze.com 2023-04-01 01:51 出处:网络
I have a web application where i am displaying an javascript alert box when user edits fields and clicks on the save button.Then i want to redirect the page to home page when user clicks \"ok\" on the

I have a web application where i am displaying an javascript alert box when user edits fields and clicks on the save button.Then i want to redirect the page to home page when user clicks "ok" on the javascript alert box ? I am using c# code

Type cstype = this.GetType();

ClientScriptManager cs = this.ClientScript;
if (!cs.IsStartupScriptRegistered(cstype, "AlertScript"))
{
    String csScriptText = "alert(' settings have been saved ');";
    cs.RegisterStartupScript(cstyp开发者_开发技巧e, "TestScript", csScriptText, true);
}


.NET really has nothing to do with it since it all happens on the client via JavaScript.

String csScriptText = "alert(' settings have been saved ');document.location='http://.../newurl.htm'";
0

精彩评论

暂无评论...
验证码 换一张
取 消