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

Window 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 Window for ASP.NET Core in Razor Pages applications.

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

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

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

    @(Html.Kendo().Window()
        .Name("window")
        .Title("Window title")
        .Content(@<text>
            <p>
             @Model.Text
            </p>        
        </text>)
        .Actions(actions => actions
            .Minimize()
            .Maximize()
            .Close()
        )   
        .Width(600)    
    )
    @inject Microsoft.AspNetCore.Antiforgery.IAntiforgery Xsrf
    @Html.AntiForgeryToken()

    @{
        string[] actions = new string[] { "Minimize", "Maximize", "Close" };
    }

    <kendo-window name="window" title="Window title" actions="@actions">
        <content><p>@Model.Text</p></content>
    </kendo-window>

    public string Text = String.Empty;
    public void OnGet()
    {
        Text = "Lorem ipsum dolor sit amet...";
    }

See Also

In this article