Blog

Most Recent Blog Entries

Feb 26

Written by: Brian Dukes
2/26/2007 3:44 PM 

The Rating control from the AjaxControlToolkit has been of use to use as we work on some of our websites that use our Engage: Publish module.  However, we needed to make a change to the style of the container around the Rating in order to change a background image from saying "Please rate!" to "Thanks for rating."  We tried wrapping it in an UpdatePanel to get at the CssClass, but we couldn't get it to react.  Eventually, we got the following javascript to work (which needs to be declared after divRating is declared).

<div id="divRating" class="divRatingBefore">
   <ajaxToolkit:Rating ID="ajaxRating".../>
</div>

<script type="text/javascript">
// Method called when the Rating is changed
function toggleCssClassMethod(eventElement) {
// Toggle CSS class
Sys.UI.DomElement.removeCssClass($get('divRating'), 'divRatingBefore');
Sys.UI.DomElement.addCssClass($get('divRating'), 'divRatingAfter');
}
// Add handler using the getElementById method
$addHandler($get('<%= ajaxRating.ClientID %>'), 'click', toggleCssClassMethod);
</script>

This adds a handler to the rating's click event which removes the initial CssClass and replaces it with the final CssClass.

Tags:

Your name:
Your email:
(Optional) Email used only to show Gravatar.
Your website:
Title:
Comment:
Add Comment   Cancel 

Purchase

Please click here to buy now.
Payment will be processed via credit card or PayPal.

Test Drive!

Want to find out how it works? Visit our demo site to see the modules in actions!

Subscribe

Sign up for our newsletter and get the latest product updates!

Online Support

Powered by DotNetNuke