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);
发布了31 篇原创文章 · 获赞 2 · 访问量 5万+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章