I’m busy building my first MVC app that uses the Telerik MVC components. Their docs specify that the ScriptRegistrar helper be called right at the bottom of a view, e.g. “at the end of the master page.”. I assume this renders a script block that must only run when the page has loaded. I normally prefer to achieve this using jQuery, and keep all my script related stuff at the top of my master page, preferably in the <head> tag. Is there anything I can do to achieve this with the Telerik components and do away with the lone and forgotten helper call at the bottom of my master page?
I’m busy building my first MVC app that uses the Telerik MVC components. Their
Share
The ScriptRegistrar has two main responsibilities:
There is an explanation why the ScriptRegistrar needs to be last in the page. This is so because all UI components must register with it during rendering. Due the lack of any life-cycle (which is a good thing by the way) the ScriptRegistrar must appear (thus render) last. Otherwise the UI components would register too late – the ScriptRegistrar would have spit its output already.
To answer your question – yes you can omit the ScriptRegistrar and include the required JavaScript files by yourself. However you then need to manually initialize the UI components. The latter is possible but undocumented.