asp.net Dynamic Add js File Call to Web Page Method

  • 2021-06-28 12:22:34
  • OfStack

An example of how asp.net dynamically adds an js file to a web page is described.Share it for your reference.The implementation is as follows:


HtmlGenericControl JsControl = new HtmlGenericControl("script");
JsControl.Attributes.Add("type", "text/javascript");
JsControl.Attributes.Add("src", url);
page.Header.Controls.Add(JsControl);

I hope that the description in this paper will be helpful to everyone's asp.net program design.


Related articles: