Displaying Alert Message Boxes from your .aspx page


Step 1 : Create a General class and place the following Code in it

public static void CreateMessageAlert(System.Web.UI.Page senderPage,
string alertMsg, string alertKey)
{
ScriptManager.RegisterStartupScript(senderPage, senderPage.GetType(), alertKey, “alert(‘” + alertMsg + “‘);”,true);
}

Step 2 : Call the created method from where ever you wish to send the alert from


string alertmessage = “Thank You for visiting DotNetSpider.com”;

YourClassName.CreateMessageAlert(this,alertmessage,”alertKey”);

Where YourClassName is nothing but the name of the class file where your
CreateMessageAlert method resides and alertmessage is where you assign the
string you wish to display.

Advertisements

One thought on “Displaying Alert Message Boxes from your .aspx page

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s