Ajax Rating Control

Rating

Rating control is used to accept rating from user and it has the following important properties.

Starcss class: Used to specify the css class to use to display the star within the rating control.

Empty starcssclass: Used to specify the cssclass to use to display an empty star with the Rating control.

Filledstarcssclass: Used to specify the cssclass to use to display a filledstar with in the rating control.

Waiting starcssclass: Used to specify the css class to use to display the star that is waiting to be selected.

MaxRating: Used to specify the maximum rating user can select.

CurrentRating: Used to get or set the current rating.

Example

The following example demonstrates how to use the rating control.

Add a page to the website and place a ToolKitScriptManager, aRating Control & a Label on the page.

With in the HTML Source of the page in the headsection create css class as follows.

<style type=”text/css”>

.star

{

width:30px;

height:30px;

background-repeat: no-repeat;

padding:0px;

margin:0px;

}

.emptystar

{

background-Image:Url(Images/emptystar.png);

}

.filledstar

{

background-Image:Url(Images/filledstar.png);

}

</style>

Within HTML source it self set following properties for the Rating control.

<asp:Rating ID=”Rating1” runat=”server” starcssclas=”Star” Emptystarcssclass=”emptystar”

filledstarcssclass=”filledstar”

waitingstarcssclass=”emptystar”

MaxRating=”5” CurrentRating=”2”

AutpostBack=”True”>

<asp:Rating>

For the label make the text property empty and write the following code with in ‘changed’ event of rating control.

Rating1-changed

{

Label1.text=”Rating Given Is” +

Rating1.currentRating.Tostring();

}

}

site www.asp.net/ajax