Right now I'm working on an extender that needs to include numerous .js files I'd like to register for inclusion on a page.
I've added:
[assembly: System.Web.UI.
WebResource("first.js","text/javascript")][assembly: System.Web.UI.
WebResource("second.js","text/javascript")]In the root of the Extender.cs class... as well as...
[ClientScriptResource("first","first.js")]
[
ClientScriptResource("second","second.js")]
Seems like if it were just one of the scripts by itslef it seems to do an ok job... but for scrips that rely on eachother, the straight up fail. Is the extender model only destined to have one script file period? If not, are scripts loaded and rendered in the order I add the ClientScriptResource attributes?
Is there another way I SHOULD be doing this? The .js files are being bundled in as Embedded Resource which is desired functionality, however the js variables that are now supposed to be present at the document scope simply arent. Somethign strange about which scripts are being loaded, or what order they are being loaded in.
Any advice would be greatly appreciated. Thanks
ClientScriptResource also takes named parameters, of which there is a LoadOrder and you can specify a load order. I found this to be the solution to my problem. Couple small little hurdles and I should be on my way.
No comments:
Post a Comment