using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.IO;
using System.Text;
using System.Web.UI;
namespace WebApplication
{
/// <summary>
/// 訊息類
///
///
/// </summary>
public class Message
{
/// <summary>
/// 母片內容頁彈出的訊息方法--主版頁面用到UpdatePanel
/// </summary>
/// <param name="page">當前彈出資訊頁面 this</param>
/// <param name="updatepanel">UpdatePanel ID</param>
/// <param name="messgaeInfo">資訊內容</param>
public static void Show(System.Web.UI.Page page, System.Web.UI.UpdatePanel updatepanel, string messgaeInfo)
{
ScriptManager.RegisterClientScriptBlock(updatepanel, page.GetType(), "click", "alert('" + messgaeInfo + "')", true);
}
/// <summary>
/// 沒有用UpdatePanel的訊息方法(父頁原樣顯示,不能用於彈出頁面,因為會關閉彈出頁面)
/// </summary>
/// <param name="page">當前彈出資訊頁面 this</param>
/// <param name="messgaeInfo">資訊內容</param>
public static void Show(System.Web.UI.Page page, string messgaeInfo)
{
page.ClientScript.RegisterStartupScript(page.GetType(), "aaaa", "<script language=javascript>alert('" + messgaeInfo + "');window.close();</script>");
}
/// <summary>
/// 沒有用UpdatePanel的訊息方法(父頁原樣顯示,不能用於彈出頁面,因為會關閉彈出頁面)
/// </summary>
/// <param name="page">當前彈出資訊頁面 this</param>
/// <param name="messgaeInfo">資訊內容</param>
public static void ShowNoClose(System.Web.UI.Page page, string messgaeInfo)
{
page.ClientScript.RegisterStartupScript(page.GetType(), "aaaa", "<script language=javascript>alert('" + messgaeInfo + "');</script>");
}
/// <summary>
/// 沒有用UpdatePanel的訊息方法(父頁原樣顯示,彈出頁面)
/// </summary>
/// <param name="page">當前彈出資訊頁面 this</param>
/// <param name="messgaeInfo">資訊內容</param>
/// <param name="temp">隨意</param>
public static void Show(System.Web.UI.Page page, string messgaeInfo, string temp)
{
page.ClientScript.RegisterStartupScript(page.GetType(), "aaaa", "<script language=javascript>alert('" + messgaeInfo + "');</script>");
}
/// <summary>
/// 沒有用UpdatePanel的訊息方法(父頁顯示空白)
/// </summary>
/// <param name="messgaeInfo">資訊內容</param>
public static void Show(string messgaeInfo)
{
System.Web.HttpContext.Current.Response.Write("<script>window.alert('" + messgaeInfo + "')</script>");
}
}
}