Code
Using System;
Using System. Collections. Generic;
Using System. text;
Using System. Web;
Using System. Web. UI;
Namespace Jcbtms. BLL. Admin
{
Public Class Msgbox
{
/**/ /// <Summary>
/// The alert dialog box is displayed on the server (for non-Ajax)
/// </Summary>
/// <Param name = "str_message"> Prompt message, for example: "enter your name! " </Param>
Public Static Void Alert ( String Str_message)
{
Clientscriptmanager scriptmanager = (Page) system. Web. httpcontext. Current. Handler). clientscript;
Scriptmanager. registerstartupscript ( Typeof ( String ), Datetime. Now. tostring () + Datetime. Now. millisecond. tostring (), " Alert (' " + Str_message + " '); " , True );
}
/**/ /// <Summary>
/// The alert dialog box is displayed on the server (for Ajax)
/// </Summary>
/// <Param name = "str_message"> Prompt message, for example: "enter your name! " </Param>
Public Static Void Alertajax ( String Str_message)
{
Scriptmanager. registerclientscriptblock (PAGE) system. Web. httpcontext. Current. Handler, Typeof ( String ), Datetime. Now. tostring () + Datetime. Now. millisecond. tostring (), " Alert (' " + Str_message + " '); " , True );
}
}
}
To use the alert method, you must add the system. Web reference. To use the alertajax method, you must add the system. Web. Extensions reference.ProgramSet the target framework to. NET Framework 3.5.