using System.Web;
using System.Text;
using System.Web.UI;
/// <summary>
/// A JavaScript alert
/// </summary>
public static class Alert
{
/// <summary>
/// Shows a client-side JavaScript alert in the browser.
/// </summary>
/// <param name="message">The message to appear in the alert.</param>
public static void Show(string message)
{
// Cleans the message to allow single quotation marks
string cleanMessage = message.Replace("'", "\\'");
string script = "<script type=\"text/javascript\">alert('" + cleanMessage + "');</script>";
// Gets the executing web page
Page page = HttpContext.Current.CurrentHandler as Page;
// Checks if the handler is a Page and that the script isn't allready on the Page
if (page != null && !page.ClientScript.IsClientScriptBlockRegistered("alert"))
{
page.ClientScript.RegisterClientScriptBlock(typeof(Alert), "alert", script);
}
}
}
대용량 데이타 다운로드 (0) | 2014.01.03 |
---|---|
ASP.NET 다국어 처리 (0) | 2013.10.21 |
Disabled Browser cash client side for asp.net (0) | 2013.06.17 |
Configuring ASP Session state on SQL server 사용 (0) | 2013.05.20 |
이미지 원하는 사이즈로 맞추기 (0) | 2012.05.18 |