OnClientRating & Ratting Zero

2 posts, 0 answers
  1. Mohammad Hajinezhad
    Mohammad Hajinezhad avatar
    6 posts
    Member since:
    Oct 2009

    Posted 03 Jun 2010 Link to this post

    Hi everyone

    I have two issue with RadRatting, I hope someone could help me.

    1- I don't know have could get value of RadRatting for validation on "OnClientRating" event, sender.get_value() just give me Old-Value, Not Current-value !!!!!!

    2- I don't know have rat 0, when ratted some value, for Example when I Rate 5 star, I can't change value to 0 star (I prefer do this, whit user click, Not with programming).

    3- It is possible that force end-users to just ratting between two values (for examples ratting between 3-8) ?!!!!!!!!

    Best Regards,
  2. Tsvetie
    Tsvetie avatar
    1517 posts

    Posted 09 Jun 2010 Link to this post

    Hi Mohammad Hajinezhad,
    Straight to your questions:
    1. The rating client-side event of the rating control is raised before the value of the control changes. That is why, get_value returns the old value - it is actually the current value of the control. You can obtain the pending value the following way:
      <telerik:RadRating ID="RadRating1" runat="server" OnClientRating="OnClientRating">
      <script type="text/javascript">
      function OnClientRating(sender, args)
    2. I am not quite sure how you want to implement this. In case you want a separate button that resets the value of the rating control to 0, you can simply define a button, style it per your specification and use its click client-side event to set the value of the rating control to 0:
      <telerik:RadRating ID="RadRating1" runat="server">
      <asp:Button ID="Button1" runat="server" OnClientClick="OnClientClick(); return false;" />
      <script type="text/javascript">
      function OnClientClick()
          $find("<%= RadRating1.ClientID %>").set_value(0);
      . On the other hand, in case you want the first item in the rating to have value=0, you can use the Items collection of the control - http://demos.telerik.com/aspnet-ajax/rating/examples/itemscollection/defaultcs.aspx.
    3. Yes, you can - you can use the Items collection of the rating control and set the Value for each item - http://demos.telerik.com/aspnet-ajax/rating/examples/itemscollection/defaultcs.aspx.

    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  3. DevCraft R3 2016 release webinar banner
Back to Top