C#后台提示警告框

1.最简单的

Response.Write
("<script>alert('查询语句执行出错!');window.location.href=DisplayData.aspx</script>");

2.一般后台弹出提示框,都是用Page.RegisterStartupScript,不用Response.Write的

Page.RegisterStartupScript("msg", "<script>alert('查询语句执行出错!');window.location.href='DisplayData.aspx'</script>");

3.

ClientScript.RegisterStartupScript(this.GetType(), "", " <script lanuage=javascript> alert('');location.href='';</script>");  

4.

System.Web.HttpContext.Current.Response.Write(String.Format("<script language=\"javascript\">alert(\"{0}\");window.location.replace(\"{1}\")</script>",
strMessage, strRedirectUrl));

5.

ScriptManager.RegisterStartupScript(this, this.GetType(), "u1", "alert('内容!')", true);

6.

Page.ClientScript.RegisterStartupScript(this.GetType(), "d", "alert('请先登录!');location='../login.aspx';", true);

 

posted @ 2012-08-15 17:27  iowns  阅读(812)  评论(0编辑  收藏  举报