Add JavaScript reference from code behind (C#)

前端 未结 3 1050
耶瑟儿~
耶瑟儿~ 2021-02-08 12:24

Is it possible to add javascript reference dynamically from code behind aspx.cs?

Like this:

private void AddScriptReference(string path)
{
   //Add refer         


        
3条回答
  •  天命终不由人
    2021-02-08 12:43

    You can use the ASP.NET Ajax ScriptManager to do so.

    Add it to your masterpage, and use ScriptManager.RegisterClientScriptInclude from your codebehind.

提交回复
热议问题