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

Unrate the first star

3 Answers 67 Views
Rating
This is a migrated thread and some comments may be shown as answers.
Arun
Top achievements
Rank 1
Arun asked on 28 Sep 2011, 07:59 PM
Hello all,

I am able to unrate other stars by clicking on already rated star now what  I need is to unrate the first star by clicking on it again

Thanks,
aRviN

3 Answers, 1 is accepted

Sort by
0
Niko
Telerik team
answered on 03 Oct 2011, 10:01 AM
Hi Arvin,

You could track the changes in the rating by handling the OnClientRated event. In there you can check if the old value is 1 and the new value is 1 again, then you can force the value to 0. Here is a sample handler method to accomplish this:
function unrateOnFirstStar(rating, args) {
    if(args.get_oldValue() == 1 && rating.get_value() == 1)
        rating.set_value(0);
}

Hope this helps.

All the best,
Niko
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
0
lupotana
Top achievements
Rank 1
answered on 18 Nov 2011, 10:47 AM
Ok for the client... but If I want use in a server side code ?

I have 3 state and I want use only two star.. 0 and 1  and 2.
When I click on a star I must enter in a function server side.

Is it possible ?
0
Niko
Telerik team
answered on 21 Nov 2011, 12:53 PM
Hello Lupotana,

  Even though the solution is on the client-side, it should work just fine with a RadRating control that is set to autopostback, because the client-side event handler will be called just before the page is being sent to the server.
Still if you wish to completely escape the client-side code, then you will need to have a way to persist the old value of the RadRating control on the server side and in the OnRate event handler you need to make the same checks and assignments as in the client-side approach.

Hope this helps.

Greetings,
Niko
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
Tags
Rating
Asked by
Arun
Top achievements
Rank 1
Answers by
Niko
Telerik team
lupotana
Top achievements
Rank 1
Share this question
or