ASP.net后台动态加载JS文件

//假设js文件在你的站点的路径:/Control/DateControl/WdatePicker.js

string _FilePath = "/Control/DateControl/WdatePicker.js";
string _RootPath = HttpContext.Current.Request.ApplicationPath;

System.Web.UI.ScriptManager.RegisterClientScriptInclude(
this
,
this.GetType()
,
"DatePicker"
, _RootPath
+ _FilePath);

 这种方法适用于以下情况:

1.所有页面需要加载相同的js文件;

2.所有页面需要加载统一命名规则的js文件;

原文地址:https://www.cnblogs.com/microtry/p/1778519.html