Kendo Script Management Position Display in MVC

I use Kendo ASP.NET MVC wrappers. I noticed that wrappers render scripts to initialize controls immediately after marking up the controls. Is there a way to configure the scripts to appear below? Previously, using ASP.NET MVC Telerik controls, you could make the script manager render all initializations below. Is it possible?

+7
source share
3 answers

In the 2013 Q1 release, they added support for deferred scripts. You can use it like this:

@(Html.Kendo().AutoCompleteFor(m => m) .Filter(FilterType.Contains) .MinLength(2) .DataSource(config => { config.Read(action, controller, routeValues); config.ServerFiltering(true); }).Deferred()) 

Note the Deferred() method at the end of the chain. Then in your layout add the following to your markup:

  <!-- ... --> @Html.Kendo().DeferredScripts() </body> </html> 

See http://www.kendoui.com/forums/mvc/general-discussions/kendo-initialization-scripts-in-body-interfere-with-other-libraries.aspx for more information.

+11
source

I regret that this is impossible and cannot be bypassed. Kendo Wrappers scripts for MVC are always displayed after the html widget shell.

It is mentioned in the documentation .

EDIT: this is later possible with deferred scripts showing jrummell exiplained.

+2
source

This will be a bit of a headache, but since the wrappers generate a jQuery script, you cannot generate the wrapper in a partial view, take the resulting script and paste it into the script tag at the bottom of the page? Of course, this would mean either duplicated code, or enough code to generate a workaround in reusable mode, so the scripts end at the bottom of the page, and not in the middle.

I assume this will help with performance (is it best to use CSS at the top and script below)?

+2
source

All Articles