Does anyone have a better idea? Thank you!
Passing messages to the user in MVC2
Ninject and repository pattern with interfaces
ASP.NET MVC 2 website doesn't seem to be picking up code changes
Lately i've adopted a Html Helper approach to common js/jQuery blocks that i need for certain complex "controls" that need a lot of ajax and UI js assistance.
Disambiguate controller actions of same name based on result type?
In my most recent case i had two of these "controls" and each one required 3 script blocks..
ITextSharp saying File not found when published to My server
I how have this helper arrangement where i can use syntax like this:.
Browser prompting download of JSON response, ASP.NET MVC2
I have this "Template" folder in my MVC "/Scripts" folder where i place the script blocks and then mark all the "variables" with an escape sequence such that i can swap/regex in my variables that i had passed into the helpers (above) as params.
<%-- // jQuery for Patron --%> <% =Html.MattyJq().DivListItemSingleSelector("selectPatronItem", "div#matchingPatrons", "patronsPrevSelectedID","PatronID") %> <% =Html.MattyJq().EmptyTextInputHelper("patronSearch", "patronsFilterSendEmpty") %> <% =Html.MattyJq().TextChangeDynamicUpdaterSelect("patronSearch","div#matchingPatrons", "/patrons/getpatronsitems",500,"patronsFilterSendEmpty","patron", "patronsPrevSelectedID","selectPatronItem") %>
Dependency injection inside ASP.NET MVC custom model binders and filters
This way i can reuse the templates and my views are much lighter/cleaner.
BadImageFormat Exception with Oracle 64 bit client running on Win 7 X64
You'll notice common params in the helpers there - that's when, for example, i have js function names or
vars that are common to more than one script block.
It's a sortof way of "linking" the isolated script blocks together.
Lastly i have a common section for the helpers which enables me to "go over" the resulting js/jQuery with a parser if i choose - in my case i use the .NET YUI Compressor to minify the js in Release builds - i'm sure you could add some logic here to ensure that all the script was at the bottom of the page if you liked..
. Throwing js all over the place is such a maintenance nightmare, even with firebug.. Remember, always program as if the person maintaining your code is a violent psychopath.