using System;
using System.Collections.Generic;
using System.Text;
using System.Web.UI;
using System.Web;
namespace Bowin.Common
{
public static class MsgBox
{
private static Page Host
{
get
{
return (Page)HttpContext.Current.Handler;
}
}
///
/// 显示提醒信息
///
///
public static void Show(string message)
{
Host.ClientScript.RegisterStartupScript(typeof(Page), "ShowMessageBox",
string.Format("alert('{0}');", message), true);
}
///
/// 显示确认窗口
///
///
public static void Confirm(string message)
{
Host.ClientScript.RegisterStartupScript(typeof(Page), "ConfirmMessageBox",
string.Format("confirm('{0}')", message), true);
}
///
/// 显示提醒信息并跳转到指定页面
///
///
///
public static void Show(string message, string url)
{
Host.ClientScript.RegisterStartupScript(typeof(Page), "ShowMessageAndRedirct",
string.Format("alert('{0}');location='{1}';", message, url), true);
}
///
/// 提醒并关闭当前窗口
///
///
///
public static void ShowAndClose(string message)
{
Host.ClientScript.RegisterStartupScript(typeof(Page), "ShowAndClose",
string.Format("alert('{0}');window.close();", message), true);
}
///
/// 提醒并刷新父窗口
///
///
///
public static void ShowAndReloadParent(string message)
{
Host.ClientScript.RegisterStartupScript(typeof(Page), "ShowAndReloadParent",
string.Format("alert('{0}');window.parent.location.reload();", message), true);
}
///
/// 刷新父页面
///
public static void ReloadParent()
{
Host.ClientScript.RegisterStartupScript(typeof(Page), "ReloadParent"
, "window.parent.location.reload();", true);
}
public static void ShowAndScript(string message, string script)
{
Host.ClientScript.RegisterStartupScript(typeof(Page), "ShowAndScript",
string.Format("alert('{0}');{1}", message, script), true);
}
}
}