This is a migrated thread and some comments may be shown as answers.

set_value fires OnClientRating event

1 Answer 42 Views
Rating
This is a migrated thread and some comments may be shown as answers.
Amir
Top achievements
Rank 1
Amir asked on 01 Oct 2011, 09:55 AM
Hello,

I have a situation where I load a RadRating control alongside a video to allow users to rate it.  I have a client side method attached to the "OnClientRating" event to capture the user entry and save it into the database.

Below it, I have a grid of other videos.  When a user clicks on the one of the videos in the grid, I get the current rating value for that video and try to set it to the rating control via the "Rating.set_value" client side api method.  However, this is causing the control to fire the "OnClientRating" event again, with the current value as the rating.  This causes a new "rating", but it was not initiated by the user, but rather via the the "set_value" method.

Is there a way to NOT fire the OnClientRating event when executing the "set_value" method?  Or, is there another way I should approach this?

Thank you.

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 03 Oct 2011, 04:57 AM
Hello Amir,

Try setting args._cancel=true to not fire the OnClientRating event in Javascript.
JS:
<script type="text/javascript">
function OnClientRating(sender, args)
{
  //your code and condition
  args._cancel=true;
}
</script>

Thanks,
Princy.
Tags
Rating
Asked by
Amir
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or