首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > C# >

怎么先提示信息后,再转到其它页面

2012-01-01 
如何先提示信息后,再转到其它页面?程序代码为:if (权限false){Response.Write(scriptalert(+该用

如何先提示信息后,再转到其它页面?
程序代码为:
if (权限==false)
{
  Response.Write("<script>alert('"+"该用户没有进入招标管理页面的权限!"+"');</script>");
  Response.Redirect("~/main.aspx");
}
else
{
 BindZbData()
}
现在的问题是:提示信息:Response.Write("<script>alert('"+"该用户没有进入招标管理页面的权限!"+"');</script>");没有显示出来?用什么方法先显示后转入页面呢?

[解决办法]
Response.Write(" <script>alert('"+"该用户没有进入招标管理页面的权限!"+"');location.href='Index.aspx';</script>"); 

[解决办法]

C# code
string msg = "该用户没有进入招标管理页面的权限";Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "js", "<script>alert('" + msg + "');window.location.href='main.aspx';</script>");
[解决办法]
飘过...
[解决办法]
Response.Write(" <script>alert('"+"该用户没有进入招标管理页面的权限!"+"');location.href='Index.aspx'; </script>"); 

楼上正解
[解决办法]
应减少使用Response.Write输出脚本..
[解决办法]
string str = "<script language='JavaScript'>alert('" + Msg + "');window.location.replace('" + Url + "');</script>";
HttpContext.Current.Response.Write(str);
[解决办法]
因为系统 先执行服务器端代码,后执行客户端js,所以会出现你的问题

程序代码为:
if (权限==false)
{
Response.Write(" <script>alert('"+"该用户没有进入招标管理页面的权限!"+"'); </script>");
//Response.Redirect("~/main.aspx");
-》Response.Write(" <script>location.href='/main.aspx'; </script>");
}
else
{
BindZbData()
}
[解决办法]
探讨
C# codestring msg = "该用户没有进入招标管理页面的权限";
Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "js", "<script>alert('" + msg + "');window.location.href='main.aspx';</script>");



href里边的路径你自己写.

热点排行