asp.net中Page.ClientScript.RegisterStartupScript用法小结

//ASP.NET后台页面跳转 

Page.ClientScript.RegisterStartupScript(Page.GetType(), "", "<script>if(confirm('保存成功!是否继续添加?')){location.href='ProductonAdd.aspx'}else{location.href='ProductonList.aspx'}</script>");

//后台弹出确定框

ClientScript.RegisterStartupScript(GetType(), "message", "<script>alert('请正确输入!');</script>");

//ASP.NET后台页面跳转

Page.ClientScript.RegisterStartupScript(Page.GetType(), "", "<script>alert('数据添加成功!');{location.href='ProductonList.aspx'}</script>");

Page.ClientScript.RegisterStartupScript(typeof(string), "", "<script>window.location.href='AdminMain.aspx';</script>");

//后台弹出文本框
ScriptManager.RegisterStartupScript(Page, typeof(string), "popUp", "window.open('rptView.aspx','打印预览','toolbar=no,location=no,scrollbars=yes,top=200px,left=200px,width=904px,height=650px')", true);

你可能感兴趣的:(asp.net)