Version

About WebRating

User Average and Vote Count

The WebRating™ control allows you to display rating images to the end users and record their input when they click on an image. The control stores the user’s average rating and vote count in the Average and VoteCount properties, respectively. A rating and corresponding vote count is only recorded when the control posts back.

You can enable full-page or asynchronous postbacks by setting the AutoPostBackFlags . Rated property. If the property is set to Async or On, the control will post back when a user clicks on a rating image.

Note
Note:

The Average and VoteCount properties only store the current user’s average and vote count; you have to determine the average and vote counts for all users if you would like to display this information.

Rating Value

The WebRating control’s average value is determined by the value specified for each rating item. This is determined by setting the Value property for each RatingImageItem object in the WebRatingImageCollection collection. The average value is then calculated based on which image was clicked and the number of clicks.

For more information on setting rating values, see Adding WebRating Items.

Rating Selection

The WebRating control selects the rating value that the user last clicked on. This selection is styled with color filling the rating image up to that value.

WebRating About WebRating 01.png

The selection is controlled by the EnableContinuousSelection property. This value is True by default which renders a selected style on all items preceding the selected value. You can set this property to False to render the selected style for only the selected item.

WebRating About WebRating 02.png

The selected rating value is controlled by the Precision property. This property takes 3 RatingPrecision enum values: Exact, Half, and Whole. The Exact value allows the end user to select a value precisely at the point that was clicked. The Half value rounds to the next half value, and Whole value rounds to the next whole value.

Note
Note:

With Half or Whole RatingPrecision values, you can still set an exact value by setting the Value property in code.

WebRating also has a property called EnableShowSelectionOnHover which controls the display of the selected rating item based on mouse hover. This property is True by default and displays the selected value as the mouse is hovered over other values. When set to False it only displays values where the mouse is hovered.

Custom Images and Styles

The WebRating control allows you to specify your own images as rating items and set custom styles for the different states of the control. By default, the control display rating images as stars. You can change the selected and hovered style by setting your own CSS class. WebRating exposes various CSS properties for you to customize the look and feel of the control.

For more information on custom styles, see Styling WebRating.