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

Razor Page

This article describes how to configure the Telerik UI Button HtmlHelper for ASP.NET Core in a RazorPage scenario.

The example below demonstrates how to pass antiforgery token when a Button is clicked. See the implementation details in the example below, and for the full project with RazorPages examples, visit our GitHub repository.


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

    <form method="post">
        <input type="text" name="description">
        <br/>
        @(Html.Kendo().Button()
            .Name("primaryTextButton")
            .HtmlAttributes(new { type = "submit", @class = "k-primary" })
            .Events(e => e.Click("onClick"))
            .Content("Submit")
        )
    </form>

    <script>
        function onClick() {
            return kendo.antiForgeryTokens();
        }
    </script>

    public class ButtonIndexModel : PageModel
    { 
        public void OnPost(string description)
        {
            .....
        }
    }

See Also

In this article
Not finding the help you need? Improve this article