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

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

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

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

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


    @(Html.Kendo().Rating()
        .Name("ratingHalf")
        .Min(Model.Min)
        .Max(Model.Max)
        .Value(Model.Value)
        .Precision(Model.Precision)
    )

    <kendo-rating name="ratingHalf"
                min="@Model.Min"
                max="@Model.Max"
                value="@Model.Value"
                precision="@Model.Precision">
    </kendo-rating>

    public string Precision { get; set; }
    public int Min { get; set; }
    public int Max { get; set; }

    public double Value { get; set; }
    public void OnGet()
    {
        Min = 1;
        Max = 10;
        Precision = "half";
        Value = 7.5;
    }

See Also

In this article