/// <Summary>
/// Customize the pop-up window content
/// </Summary>
/// <Param name = "msg"> </param>
Public static void AjaxShowWindows (string msg)
{
// MyContext. Response. Write ("<script> export the window generation parameters (wondows. open (XXX); </script> ");
String script = "generate window generation parameters (wondows. open (XXX);"; // note the window ID. It is best to use a host. Otherwise, only one output is allowed.
ScriptManager. RegisterStartupScript (System. Web. UI. Page) HttpContext. Current. CurrentHandler, typeof (System. Web. UI. Page), "ShowWindows", script, true );
}
=
Using System;
Using System. Collections. Generic;
Using System. Text;
Using System. Web;
Using System. Web. UI;
Public class ShowMessage
{
/// <Summary>
/// Customize the content of the pop-up window. Do not jump
/// </Summary>
/// <Param name = "page"> </param>
/// <Param name = "msg"> </param>
Public static void Show (System. Web. UI. Page page, string msg)
{
Page. ClientScript. RegisterStartupScript (page. GetType (), "ShowMessage", "alert ('" + msg + "');", true );
}
/// <Summary>
/// Customize the pop-up window content and jump
/// </Summary>
/// <Param name = "page"> </param>
/// <Param name = "msg"> </param>
/// <Param name = "returnUrl"> </param>
Public static void Show (System. Web. UI. Page page, string msg, string returnUrl)
{
Page. clientScript. registerStartupScript (page. getType (), "ShowMessage", "alert ('" + msg + "'); window. location. href = '"+ returnUrl +"'; ", true );
}
/// <Summary>
/// Customize the pop-up window content and jump
/// </Summary>
/// <Param name = "page"> </param>
/// <Param name = "msg"> </param>
/// <Param name = "returnUrl"> </param>
Public static void Show (System. Web. UI. Page page, string msg, string trueReturnUrl, string falseReturnUrl)
{
Page. clientScript. registerStartupScript (page. getType (), "ShowMessage", "if (confirm ('" + msg + "') {javascript: location = '" + trueReturnUrl + "';} else {javascript: location = '"+ falseReturnUrl +"';} ", true );
}
/// <Summary>
/// Customize the pop-up window content
/// </Summary>
/// <Param name = "msg"> </param>
Public static void AjaxShow (string msg)
{
// MyContext. Response. Write ("<script> alert ('" + msg + "'); </script> ");
ScriptManager. registerStartupScript (System. web. UI. page) HttpContext. current. currentHandler, typeof (System. web. UI. page), "ShowMessage", "alert ('" + msg + "');", true );
}
/// <Summary>
/// Customize the pop-up window content and direct it to a new page
/// </Summary>
/// <Param name = "msg"> </param>
/// <Param name = "url"> </param>
Public static void AjaxShow (string msg, string url)
{
// MyContext. response. write ("<script> alert ('" + msg + "'); javascript: location = '" + Url + "'; </script> ");
ScriptManager. registerStartupScript (System. web. UI. page) HttpContext. current. currentHandler, typeof (System. web. UI. page), "ShowMessage", "alert ('" + msg + "'); javascript: location = '" + url + "';", true );
}
/// <Summary>
/// Customize the pop-up window content and choose whether to direct or prompt to switch to a new page
/// </Summary>
/// <Param name = "msg"> </param>
/// <Param name = "isreturn"> </param>
/// <Param name = "url"> </param>
Public static void AjaxShow (string msg, bool isreturn, string url)
{
If (! Isreturn)
{
// MyContext. response. write ("<script> alert ('" + msg + "'); javascript: location = '" + Url + "'; </script> ");
ScriptManager. registerStartupScript (System. web. UI. page) HttpContext. current. currentHandler, typeof (System. web. UI. page), "ShowMessage", "alert ('" + msg + "'); javascript: location = '" + url + "';", true );
}
Else
{
// MyContext. response. write ("<script> alert ('" + msg + "'); javascript: location = '" + Url + "'; </script> ");
ScriptManager. registerStartupScript (System. web. UI. page) HttpContext. current. currentHandler, typeof (System. web. UI. page), "ShowMessage", "if (confirm ('" + msg + "') {javascript: location = '" + url + "';}", true );
}
}
/// <Summary>
/// Customize the pop-up window content to determine whether to close the current page
/// </Summary>
/// <Param name = "msg"> </param>
/// <Param name = "close"> </param>
Public static void AjaxShow (string msg, bool close)
{
If (close)
{
// MyContext. Response. Write ("<script> alert ('" + msg + "'); javascript: window. close (); </script> ");
ScriptManager. registerStartupScript (System. web. UI. page) HttpContext. current. currentHandler, typeof (System. web. UI. page), "ShowMessage", "alert ('" + msg + "'); javascript: window. close (); ", true );
}
Else
{
// MyContext. Response. Write ("<script> alert ('" + msg + "'); </script> ");
ScriptManager. registerStartupScript (System. web. UI. page) HttpContext. current. currentHandler, typeof (System. web. UI. page), "ShowMessage", "alert ('" + msg + "');", true );
}
}
}