/// <summary> /// You must use a ScriptManager control on a page to enable the following features of ASP.NET AJAX: ///•Client-script functionality of the Microsoft AJAX Library, and any custom script that you want to send to the browser. For more information, see ASP.NET AJAX and JavaScript. ///•Partial-page rendering, which enables regions on the page to be independently refreshed without a postback. The ASP.NET AJAX UpdatePanel, UpdateProgress, and Timer controls require a ScriptManager control to support partial-page rendering. ///•JavaScript proxy classes for Web services, which enable you to use client script to access Web services by exposing Web services as strongly typed objects. ///•JavaScript classes to access ASP.NET authentication and profile application services. /// http://forums.asp.net/t/1169763.aspx/1 /// </summary> public static void Alert(string Msg, Control ctl) { string Alert = CScript.GetScriptAlertJQuery(Msg); ScriptManager.RegisterStartupScript(ctl, ctl.GetType(), "AlertOnStartup", Alert, true); }
public static void Alert(string Msg, Page p) { string Alert = CScript.GetScriptAlertJQuery(Msg); p.ClientScript.RegisterStartupScript(typeof(Page), "AlertOnStartup", Alert, true); }