ASP.NET Pack Programmer's Guide
Rating

The Rating control provides the ability to select and display ratings. It represents a container of RatingItem objects, which can be selected and deselected.

Server side

Getting and setting the control's value

Use the Rating.Value property to get or set the control's current value.

Customizing the control

The number of items, displayed in the Rating control can be specified either by setting the ItemsCount property to the desired value or by defining individual items. If the ItemsCount property is used, the items will be created automatically and their images will be set according to the specified Theme. The default images can be changed on the root level by setting the ItemsImageUrl, ItemsActiveImageUrl, ItemsSelectedImageUrl and ItemsActiveSelectedImageUrl properties.

By defining individual items you can customize the appearance of the control by setting specific images to the different items. If the defined items count is less then the specified ItemsCount, the control will generate additional items with the default settings until the value of ItemsCount is reached.

Items can be arranged horizontally or vertically by setting the Orientation property.

The Rating control supports three different selection modes, defined in the RatingMode enumeration.

Events

The following events are exposed by the Rating class.

Event

Event arguments

Description

ValueChanged

ValueChangedEventArgs<Double>

Raised when the value of the control has changed.

Client side

Getting a reference to the control

You can access the control on the client side by its ClientID.

JavaScript  Copy Code

var rating = $find("Rating1");
var rating = $find("<%= Rating1.ClientID %>");

Getting and setting the control's value

Use the get_value and set_value methods to get or set the control's value.

JavaScript  Copy Code

rating.set_value(3.2);
alert(rating.get_value());

Events

The following client-side event are exposed by the Rating class.

Event

Event arguments

Script property

Description

valueChanging

ValueChangingEventArgs

ValueChangingScript

Raised when a control value is about to be changed.

valueChanged

ValueChangedEventArgs

ValueChangedScript

Raised when a control value has changed.

controlLoaded

-

ControlLoadedScript

Raised just after the control has finished loading and is ready for interaction.