Introduction : The Rating control provides an intuitive rating experience that allows users to select the number of stars that represents their rating. The page designer can specify the initial rating, the maximum rating to allow, the alignment and direction of the stars, and custom styles for the different states a star can have. Rating also supports a ClientCallBack event that allows custom code.
Rating Control Properties :
- Behaviour ID.
- MaxRating.
- StarCssClass.
- WaitingStarCssClass.
- FilledStarCssClass.
- OnChanged.
- ToolTip.
Step 1 : Open Visual Studio 2010.
- Go to File->New->WebSite.
- Select ASP.NET WebSite.

Step 2 : Go to Solution Explorer and right-click.
- Select Add-> New Item.
- Select WebForm.
- Default.aspx page open.

Step 3 : Drag controls from Toolbox.
- Drag ScriptManager, UpdatePanel, Rating Control in Default.aspx page.
- Drag Rating control from Ajax Control Toolkit.
- Go to Design option and see the page.
- Write the below simple code in the Default.aspx page.

Code :
<title>My
rating application</title>
</head>
<body>
<form
id="form1"
runat="server">
<asp:ScriptManager
ID="ScriptManager1"
runat="server">
</asp:ScriptManager>
<div>
<asp:UpdatePanel
ID="UpdatePanel1"
runat="server">
<ContentTemplate>
<!-- Declare Rating Control Here
-->
<asp:Rating
ID="Rating1"
runat="server"
BehaviorID="RatingBhvrId1"
CurrentRating="4"MaxRating="6"
StarCssClass="ratingStar"
WaitingStarCssClass="savedRatingStar"
FilledStarCssClass="filledRatingStar"
EmptyStarCssClass="emptyRatingStar"
OnChanged="Rating1_Changed"
ToolTip="Please Rate!"
style="float:left;"
BackImageUrl="~/image/images.jpeg"
Height="211px"
Width="200px"
BackColor =
"Aqua" BorderColor
=
"red">
</asp:Rating>
<!-- Label to Display Message -->
<span
id="lblResponse" class="heading"></span>
</ContentTemplate>
</asp:UpdatePanel
</div>
</form>
</body>
</html>
Step 4 : Declare Javascript
for rating with the help of CallbackResult.




Join the conversation! Your thoughts help the community grow.