警告 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 - 锐客网
推荐阅读
- 记一次 .NET 某药品仓储管理系统 卡死分析
- IIS发布.net连接不上数据库解决办法
- 浅谈.NET 6 中 gRPC 的最新功能
- 利用Visual Studio 2017的扩展开发(VSIX、ItemTemplate) 快速实现项目的半自动化搭建
- C#进度条实现
- .net|利用MSXML2.XMLHTTP的无刷新技术
- 配置VS2008中文版调试.netframework源代码
- .net|解决Win8.1下VS2005编辑报错的问题
- Java与C#间json时间格式互转完美解决方案
- 在VS.NET内使用“从源代码管理打开”时出现无法读取项目文件的错误