当前位置: 代码迷 >> ASP.NET >> 求救:MsgBox,该如何处理
  详细解决方案

求救:MsgBox,该如何处理

热度:5611   发布时间:2013-02-25 00:00:00.0
求救:MsgBox
在后台代码中有MsgBox()函数
我用客户端访问服务器时,MsgBox根本不能显示在客户端端上啊?是不是不能这么用阿?
如果通过后台检查后,在前台弹提示消息,应该怎么做啊?

------解决方案--------------------------------------------------------
/// <summary>
/// 弹出对话框根据IsClose的指示是否关掉页面
/// </summary>
/// <param name= "mypage "> </param>
/// <param name= "info "> </param>
/// <param name= "IsClose "> </param>
public static void showmessage(System.Web.UI.Page mypage, string info, bool IsClose)
{
info = info.Replace( "\n ", " ");
//string scriptClientId=string.Empty;
string strscript = " <script language= 'javascript '> ";
strscript += "alert( ' " + info + " '); ";
if (IsClose)
{
strscript += "opener=null; ";
strscript += "window.close(); ";
}
strscript += " </script> ";
if (!mypage.ClientScript.IsStartupScriptRegistered( "ShowMsg "))
mypage.ClientScript.RegisterStartupScript(mypage.GetType(), "ShowMsg ", strscript);

}