I am trying to include the js and css in my code behind in my master pages and user controls in Page_Load event.
But apparently, js breaks since Page_Load of user controls loads BEFORE Page_Load of a master page. I include my jquery libs used across the site in my master pages, but scripts used in user control are included in user control only. The thing is that user control js scrips uses jquery functionality (as it should), but when it tried to run, it breaks since jquery libs are not loaded yet. Anwyays, is there a way around this frustrating mess?
I use this to include js in my code behind. relativeResolvedPath is basically ResolveUrl(url)
HtmlGenericControl js = new HtmlGenericControl("script");
js.Attributes.Add("type", "text/javascript");
js.Attributes.Add("src", relativeResolvedPath);
Page.Header.Controls.Add(js);