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

Razor Page

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

The example below demonstrates how to pass antiforgery token when an item from the ContextMenu is selected. 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

    <div id="target">Right click here</div>

        .Items(items =>

        .Events(e =>


        function onSelect(e) {
            if ($(e.item).text() == "Edit") {
                    url: "/ContextMenu/ContextMenuIndex?handler=Custom",
                    type: "POST",
                    contentType: "application/json",
                    headers: {
                        RequestVerificationToken: $('input:hidden[name="__RequestVerificationToken"]').val()

    public void OnPostCustom()

See Also

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