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 MySite.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.
No comments:
Post a Comment