.net 后台页面中,如果需要弹出窗口,可以用js,但是RegisterStartupScript 方法已被停用。可以改用 ClientScriptManager 类的 RegisterStartupScript 方法 实现
//ASP.NET后台页面跳转
Page.ClientScript.RegisterStartupScript(Page.GetType(), "", "<script>if(confirm('保存成功!是否继续添加?')){location.href='1.aspx'}else{location.href='2.aspx'}</script>");
//后台弹出确定框
ClientScript.RegisterStartupScript(GetType(), "message", "<script>alert('请输入!');</script>");
//ASP.NET后台页面跳转
Page.ClientScript.RegisterStartupScript(Page.GetType(), "", "<script>alert('成功!');{location.href='ProductonList.aspx'}</script>");
//or
Page.ClientScript.RegisterStartupScript(typeof(string), "", "<script>window.location.href='1.aspx';</script>");
//后台弹出文本框
ScriptManager.RegisterStartupScript(Page, typeof(string), "popUp", "window.open('1.aspx','打印预览','toolbar=no,location=no,scrollbars=yes,top=200px,left=200px,width=600px,height=600px')", true);
//普通弹出
//Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('请输入正确的用户名和密码!');</script>");
//确认跳转1还是2
//Page.ClientScript.RegisterStartupScript(Page.GetType(), "", "<script>if(confirm('保存成功!是否继续添加?')){location.href='1.aspx'}else{location.href='1.aspx'}</script>");
//弹出并跳转
// Page.ClientScript.RegisterStartupScript(Page.GetType(), "", "<script>alert('数据添加成功!');{location.href='ProductonList.aspx'}</script>");
//直接跳转
//Page.ClientScript.RegisterStartupScript(typeof(string), "", "<script>window.location.href='1.aspx';</script>");
//弹出新小窗口
ScriptManager.RegisterStartupScript(Page, typeof(string), "popUp", "window.open('shaopic.aspx','打印预览','toolbar=no,location=no,scrollbars=yes,top=200px,left=200px,width=904px,height=650px')", true);
//弹出新大窗口
// Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>window.open('XXX.aspx','_blank');</script>");
//对话框形式打开新窗口;
//Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>window.showModelessDialog('XXX.aspx')</script>");
Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>window.showModelDialog('XXX.aspx')</script>");
//button 添加确认框
// btnDeleteAdmin.Attributes.Add("onclick", "return confirm('你确认要删除吗?')");