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

"Unrate" with SelectionMode=Single

8 Answers 149 Views
Rating
This is a migrated thread and some comments may be shown as answers.
Rob
Top achievements
Rank 1
Rob asked on 13 Jan 2010, 08:28 AM
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).

8 Answers, 1 is accepted

Sort by
0
Accepted
Tsvetie
Telerik team
answered on 15 Jan 2010, 12:39 PM
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.
0
Rob
Top achievements
Rank 1
answered on 15 Jan 2010, 01:07 PM
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

0
Tsvetie
Telerik team
answered on 15 Jan 2010, 01:58 PM
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.
0
Sasa
Top achievements
Rank 1
answered on 09 Jul 2010, 09:39 AM
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>
0
George
Top achievements
Rank 1
answered on 22 Sep 2010, 11:09 AM
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
0
Morten
Top achievements
Rank 2
Iron
Iron
Veteran
answered on 27 Oct 2010, 01:28 PM
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?
0
Sasa
Top achievements
Rank 1
answered on 28 Oct 2010, 08:07 PM
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?
0
Tsvetie
Telerik team
answered on 29 Oct 2010, 08:10 AM
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
Tags
Rating
Asked by
Rob
Top achievements
Rank 1
Answers by
Tsvetie
Telerik team
Rob
Top achievements
Rank 1
Sasa
Top achievements
Rank 1
George
Top achievements
Rank 1
Morten
Top achievements
Rank 2
Iron
Iron
Veteran
Share this question
or