Using C1Rating Extender Events
In This Topic
Create a new ASP.NET Web application.
-
Add a standard Panel control to the main content of your page and set the ID to ratingDiv.
-
Click the Panel smart tag and choose Add Extender from the Panel Tasks menu.
-
In the Extender Wizard, select the C1RatingExtender from the list and click OK. A C1RatingExtender control is added to the page and the TargetControlID is set to ratingDiv.
-
Select View | Properties in the Visual Studio menu.
-
Click the drop-down list at the top of the Properties window and select ratingDiv_C1RatingExtender.
-
Set the C1RatingExtender.OnClientHover event to starHover.
-
Set the C1RatingExtender.OnClientRated event to starRated.
-
Add the following script to the first set of <asp:Content> tags.
<script type="text/javascript">
function starHover(e, args) {
$("#hover").html(args.value);
}
function starRated(e, args) {
$("#rated").html(args.value);
}
</script>
-
Add the following markup to the second set of <asp:Content> tags, after the closing </div> tag.
<div>hover value is:<label id="hover"></label></div>
<div>rated value is:<label id="rated"></label></div>
-
Press F5 to run your application. Click on the stars to use the rating control. The events should fire and the page should resemble the following image.
