Hi all,
I'm currently trying to find a good way to load my javascript files only when I need them. In order to do this, I created several HtmlHelpers for faceboxlinks, datepickerfields, tinymcefields and other scripts that need an external js and an initialisation jquery expression.
In these helpers I execute the script using jQuery's getScript()
and use its callback function to init the script.
Now my problem comes. My initial thought was to keep track of these scripts in a List of Strings and put this in htmlHelper.ViewData. But, unfortunately this fails. For some reason, this viewdata isn't passed to partial views or something similar; it doesn't keep the list..
Is there another place where I can globally keep my list of strings instead of the ViewDataDictionary of the helper, or am I using this ViewData in a wrong way and should I pass it on for some reason? Any clarification or help would be very appreciated!