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.
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.
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.
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.
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.
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.
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.