"Unrate" with SelectionMode=Single

9 posts, 1 answers
  1. Rob
    Rob avatar
    6 posts
    Member since:
    Jul 2009

    Posted 13 Jan 2010 Link to this post

    Assume this definition
    <telerik:RadRating Runat="server" ID="RadRatingList" ItemCount="4" SelectionMode="Single"></telerik:RadRating> 


    How can a user undo a wrong rating?
    It's possible to choose another rating but not rate at all.

    With a SelectionMode="Continuous" you can simply click on the left side to remove the rating.

    The most natural way would be to simply click on the selected rating (toggle).
  2. Answer
    Tsvetie
    Admin
    Tsvetie avatar
    1517 posts

    Posted 15 Jan 2010 Link to this post

    Hello Robert Bill,
    I am not quite sure I understand your requirement completely. Generally, when you use SelectionMode="Continuous" and the user selects the third star, the first, second and third star will be marked as selected. In case the user decides that this rating is wrong and then selects the second star, the third star will be marked as not selected and the first and second star will be marked as selected.

    Similarly, in case SelectionMode="Single" and the user selects the third star, only the third star will be marked as selected. Then, when the user decides to change the rating to 2, he/she can click on the second star and then the third star will be marked as not selected and the second star will be marked as selected.

    In both cases, a user cannot set 0 as value for the control or in other words clear the selection. In case you need this, you can implement a button that will reset the value of the rating control either using the client-side API or the server-side API of the rating.

    Kind regards,
    Tsvetie
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Rob
    Rob avatar
    6 posts
    Member since:
    Jul 2009

    Posted 15 Jan 2010 Link to this post

    Hello Tsvetie
    you are right, it doesn't work as I expected even in the continuous mode.

    Obviously a "reset" button would be a possible solution, but I would prefer that the control would support a reset (set to 0) out-of-the-box. An example can be found at http://www.fyneworks.com/jquery/star-rating/ with an integrated "reset" button.

    Best regards,
    Rob

  5. Tsvetie
    Admin
    Tsvetie avatar
    1517 posts

    Posted 15 Jan 2010 Link to this post

    Hi Robert Bill,
    We are currently working on an items collection feature for the rating control that will allow you to define the items for the control. This will make the task of implementing a reset button a lot easier as you will be able to set Value and CssClass for each item.

    Nevertheless, I will log your suggestion in our database for consideration.

    Best wishes,
    Tsvetie
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  6. Sasa
    Sasa avatar
    12 posts
    Member since:
    Aug 2007

    Posted 09 Jul 2010 Link to this post

    I'm not very fond of a "reset button" idea. It is more intuitive that a user can reset by simply clicking again on the current rating (toggle). This is the approach I use (if I'm not mistaken, this wasn't possible prior to 2010 version because OnClientRating wasn't being fired if user clicked on the current value):

    <telerik:RadRating ID="rating" runat="server" ItemCount="5" SelectionMode="Single" OnClientRating="Rating_ClientRating" />
    <script type="text/javascript">
        function Rating_ClientRating(sender, args) {
            var newValue = args.get_newValue();
            var oldValue = sender.get_value();
     
            if (newValue == oldValue) {
                sender.set_value(0);
                args.set_cancel(true);
            }
        }
    </script>
  7. George
    George  avatar
    7 posts
    Member since:
    Sep 2006

    Posted 22 Sep 2010 Link to this post

    I was running into a problem where the RadRating will not clear the selection after adding a reset button that uses a JQuery AJAX call. The first time the user resets the rating the control gets cleared but the second time the selection doesn't get clear.

    I came up with this workaround and thought about sharing it. I used JQuery as follows:

    $("[id$='_RadRating1']").children(':first-child').children('li').removeClass();
    $("[id$='_RadRating1']").find('span.rrtPart').remove();

    Best,

    George
  8. Morten
    Morten avatar
    267 posts
    Member since:
    Jul 2012

    Posted 27 Oct 2010 Link to this post

    Hi sasa
    I'm trying out your code and get object doesn't support property or method: when attempting args.get_newValue();

    Looking at the the client side object ( http://www.telerik.com/help/aspnet-ajax/radrating-client-side-api.html ) the methods you use are not supported.

    Is your code actual or just what you would want RadRating supported?
  9. Sasa
    Sasa avatar
    12 posts
    Member since:
    Aug 2007

    Posted 28 Oct 2010 Link to this post

    Hi Morten.

    The code you're referring to is in fact actual. Since that method is clearly not documented I must have "came up" with it from somewhere on these forums.

    As I've said in my previous post, this approach was not possible in earlier versions, simply 'cause OnClientRating wasn't being fired when clicking on current rating value.

    I currently use Telerik.Web.UI assembly v2010.2.713.35 and it works without problems.

    I am curious, though; could someone from Telerik team confirm if this method is supported?
  10. Tsvetie
    Admin
    Tsvetie avatar
    1517 posts

    Posted 29 Oct 2010 Link to this post

    Hi Sasa,
    Yes, the method is supported. We have on our ToDo list the task to update the documentation of RadRating with information about this, and other methods. I apologize for any inconvenience that this omission might have caused.

    Regards,
    Tsvetie
    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
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017