New to Telerik UI for ASP.NET Core? Download free 30-day trial

Loader in Razor Pages

Razor Pages is an alternative to the MVC pattern that makes page-focused coding easier and more productive. This approach consists of a cshtml file and a cshtml.cs file (by design, the two files have the same name).

You can seamlessly integrate the Telerik UI Loader for ASP.NET Core in Razor Pages applications.

This article describes how to configure the Loader component in a Razor Pages scenario.

For the complete project, refer to the Loader in Razor Pages example.

    @page
    @model Telerik.Examples.RazorPages.Pages.Loader.LoaderIndexModel    

    @inject Microsoft.AspNetCore.Antiforgery.IAntiforgery Xsrf
    @Html.AntiForgeryToken()

    @(Html.Kendo().Loader()
        .Name("loader")
        .Size(Model.Size)
        .ThemeColor(Model.ThemeColor)
    )
    @page
    @model Telerik.Examples.RazorPages.Pages.Loader.LoaderIndexModel    

    @inject Microsoft.AspNetCore.Antiforgery.IAntiforgery Xsrf
    @Html.AntiForgeryToken()

    <kendo-loader name="loader"
        size="Model.Size" 
        themeColor="Model.ThemeColor">
    </kendo-loader>
    public class LoaderIndexModel : PageModel
    {
        public LoaderSize Size { get; set; }

        public LoaderThemeColor ThemeColor { get; set; }
        public void OnGet()
        {
            ThemeColor = LoaderThemeColor.Success;
            Size = LoaderSize.Large;
        }
    }

See Also

In this article