Back to Devexpress

RatingControl

aspnetmvc-16278-components-multi-use-site-extensions-rating-control.md

latest1.8 KB
Original Source

RatingControl

  • Feb 01, 2023

The DevExpress ASP.NET MVC RatingControl extension allows users to rate web site content by clicking icons that represent ratings (“stars” by default).

To learn more about RatingControl and see it in action, refer to the online Rating Control demos.

Implementation Details

RatingControl is realized by the RatingControlExtension class. Its instance can be accessed via the ExtensionsFactory.RatingControl helper method, which is used to add a RatingControl extension to a view. This method’s parameter provides access to the RatingControl ‘s settings implemented by the RatingControlSettings class, allowing you to fully customize the extension.

The RatingControl extension’s client counterpart is represented by the ASPxClientRatingControl object.

Declaration

RatingControl can be added to a view in the following manner.

razor
@Html.DevExpress().RatingControl( settings => {
    settings.Name = "ratingControl1";
    settings.Titles = "1,2,3,4,5,6,7";
    settings.ItemCount = 7;

    settings.FillPrecision = DevExpress.Web.ASPxRatingControl.RatingControlItemFillPrecision.Exact;
}).Bind((decimal)5.66).GetHtml()

The image below illustrates the results.

See Also

DevExpress ASP.NET MVC: The RatingControl ExtensionGetting started video: