123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 |
- 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;
- }
- }
- /// <summary>
- /// 显示提醒信息
- /// </summary>
- /// <param name="message"></param>
- public static void Show(string message)
- {
- Host.ClientScript.RegisterStartupScript(typeof(Page), "ShowMessageBox",
- string.Format("alert('{0}');", message), true);
- }
- /// <summary>
- /// 显示确认窗口
- /// </summary>
- /// <param name="message"></param>
- public static void Confirm(string message)
- {
- Host.ClientScript.RegisterStartupScript(typeof(Page), "ConfirmMessageBox",
- string.Format("confirm('{0}')", message), true);
- }
- /// <summary>
- /// 显示提醒信息并跳转到指定页面
- /// </summary>
- /// <param name="message"></param>
- /// <param name="url"></param>
- public static void Show(string message, string url)
- {
- Host.ClientScript.RegisterStartupScript(typeof(Page), "ShowMessageAndRedirct",
- string.Format("alert('{0}');location='{1}';", message, url), true);
- }
- /// <summary>
- /// 提醒并关闭当前窗口
- /// </summary>
- /// <param name="message"></param>
- /// <param name="refParentPage"></param>
- public static void ShowAndClose(string message)
- {
- Host.ClientScript.RegisterStartupScript(typeof(Page), "ShowAndClose",
- string.Format("alert('{0}');window.close();", message), true);
- }
- /// <summary>
- /// 提醒并刷新父窗口
- /// </summary>
- /// <param name="message"></param>
- /// <param name="refParentPage"></param>
- public static void ShowAndReloadParent(string message)
- {
- Host.ClientScript.RegisterStartupScript(typeof(Page), "ShowAndReloadParent",
- string.Format("alert('{0}');window.parent.location.reload();", message), true);
- }
- /// <summary>
- /// 刷新父页面
- /// </summary>
- 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);
- }
- }
- }
|