Open Closed

How To Guide: Using Telerik Kendo UI in NetZero 8.1 Core 3.1 jQuery #8282

outdoored created

I have ported my NetZero 6.91 Net Core 2.2 jQuery app over to 8.1 Net Core 3.1 jQuery here are a few tips for getting Kendo UI to work. Hope this is helpful.


using Newtonsoft.Json.Serialization;

    public IServiceProvider ConfigureServices(IServiceCollection services)
        // MVC
        services.AddControllersWithViews(options =>
            options.Filters.Add(new AbpAutoValidateAntiforgeryTokenAttribute());

#if DEBUG .AddRazorRuntimeCompilation() #endif

        //Added for Kendo Serialization
        .AddNewtonsoftJson(options => options.SerializerSettings.ContractResolver = new DefaultContractResolver()); 

       //Further down in file

The Kendo JS files need to be loaded in the header -

Make changes to your _Layout.cshtml file Areas\Admin\Views\Layout__Layout.cshtml

HEADER - Add style sheets and javascript

Take the entire NetZero Scripts section that is at the bottom of the page between the <!--begin::Base Scripts --> tags and move it up into the header

 <!--begin::Base Scripts -->
<!-- Add the Kendo JS at the end of the scripts section so it is called after jQuery has loaded -->
     <script src="~/lib/kendo-ui/js/kendo.all.min.js"></script>
     <script src="~/lib/kendo-ui/js/kendo.aspnetmvc.min.js"></script>
 <!--end::Base Scripts -->

EDITED: NOT NECESSARY Find the section for RenderSection("Scripts - it is right after Change to true

~~ @RenderSection("Scripts", true) ~~~~

2 Answer(s)
  • 1
    demirmusa created

    Hi @outdoored

    Thanks for documentation.

    The second parameter of RenderSection is required. If you set it requeired all views uses that layout must add that section.

    Why did you need to make it required?

    Here is its summary

    /// <summary>
    /// In layout pages, renders the content of the section named <paramref name="name" />.
    /// </summary>
    /// <param name="name">The section to render.</param>
    /// <param name="required">Indicates if this section must be rendered.</param>
    /// <returns>An empty <see cref="T:Microsoft.AspNetCore.Html.IHtmlContent" />.</returns>
    /// <remarks>The method writes to the <see cref="P:Microsoft.AspNetCore.Mvc.Razor.RazorPageBase.Output" /> and the value returned is a token
    /// value that allows the Write (produced due to @RenderSection(..)) to succeed. However the
    /// value does not represent the rendered content.</remarks>
    public HtmlString RenderSection(string name, bool required);
  • 0
    outdoored created

    Thanks for the reply. That had worked for me in 6.91. You are correct. It is not necessary to change the RenderSection. It should be

    @RenderSection("Scripts", false)