7
Vote

Support for inline scripts

description

It would be very useful if CD allowed registration of inline script blocks similar to how it allows registration of script dependencies.

Maybe this could be implemented as a user control.

<CD:InlineScript priority="6">
$("form:first").submit(...);
</CD:InlineScript>

Later, when Html.RenderJsHere() is called, the accumulated inline scripts would be output after any dependent scripts.

comments

adegraaf wrote Apr 12, 2012 at 1:53 AM

Including a way to add script to the loader via code ...
e.g.

string culture = GetIsoLanguageCode();
string code = string.Format("alert('You are viewing the site in language "{0}"');", culture);

var cdLoader = ClientDependencyLoader.GetInstance();
cdLoader.RegisterInline(code);