Is it possible to add javascript reference dynamically from code behind aspx.cs?
Like this:
private void AddScriptReference(string path)
{
//Add refer
For those who want to know the syntax, here it is:
Master Page:
Code behind:
ScriptReference sr = new ScriptReference("path-to-js.js");
ScriptManager sm = (ScriptManager)this.Master.FindControl("ScriptManager");
sm.Scripts.Add(sr);
Or:
ScriptManager.RegisterClientScriptInclude(this.Page, GetType(), "UniqueID", "path-to-js.js");
But none of these solutions actually add the script to the head of the page..