New to Telerik UI for ASP.NET CoreStart a free 30-day trial

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

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

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

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

	@(Html.Kendo().Dialog()
        .Name("dialog")
        .Title("Data Update")
        .Content("<p>Would you like to confirm updating the data?<p>")
        .Width(400)
        .Modal(false)
        .Actions(actions =>
        {
            actions.Add().Text("Cancel");
            actions.Add().Text("Send data").Primary(true).Action("onSendData");
        })
	)	

	<script>
		function onSendData() {
			$.ajax({
				url: "/Dialog/DialogIndex",
				type: "POST",				
				headers: {
					RequestVerificationToken: kendo.antiForgeryTokens().__RequestVerificationToken
				},
				dataType: "json"
			});
		}
	</script>

See Also

In this article
See Also
Not finding the help you need?
Contact Support