System.Web.UI.Page.RegisterStartupScript(string, string)”已过时的解决办法

警告 1“System.Web.UI.Page.RegisterStartupScript(string, string)”已过时:“The recommended alternative is ClientScript.RegisterStartupScript(Type type, string key, string script). http://go.microsoft.com/fwlink/?linkid=14202”C:\Inetpub\wwwroot\BeylandSoft05\BeylandSoft05\BeylandSoft05\BeylandSoft.cs1245 6 BeylandSoft05
_page.RegisterStartupScript("","");


【System.Web.UI.Page.RegisterStartupScript(string, string)”已过时的解决办法】

过时的语句:Page.RegisterStartupScript("calis", "");


使用新的语句:ScriptManager.RegisterClientScriptBlock(this.Page,this.GetType(), "Startup", "",true);








ClientScriptManager.RegisterStartupScript 方法 (Type, String, String, Boolean)

命名空间:System.Web.UI
程序集:System.Web(在 system.web.dll 中)



public void RegisterStartupScript ( Type type, string key, string script, bool addScriptTags )

参数
type
要注册的启动脚本的类型。
key
要注册的启动脚本的键。
script
要注册的启动脚本文本。
addScriptTags
指示是否添加脚本标记的布尔值。
下面是MSDN给出的实例!
ClientScriptManager Example - 锐客网





    推荐阅读