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

half rad star not setting in code behind

1 Answer 59 Views
Rating
This is a migrated thread and some comments may be shown as answers.
harsh
Top achievements
Rank 1
harsh asked on 16 Nov 2010, 04:43 PM
Dear telerik team,
I am getting issue while setting radstar value in decimal. for example when I set the radstar value 2.6 or 2.3 it's still displaying only 2 star rated not 2 and half.

I have done following code on page_load

RadRating

 

radRating = new RadRating();

 

 


radRating.ItemCount = 5;

radRating.SelectionMode =

RatingSelectionMode.Continuous;

 

radRating.Precision =

 

RatingPrecision.Exact;

 

radRating.Value = 5/2;

when page loads only 2 star are displaying dark means rated not '2 and half' star. or when radRating.Value = 9/2; it shows only 4 star shadowed(rated).

how it could be resolved please suggest me.

 

1 Answer, 1 is accepted

Sort by
0
Tsvetie
Telerik team
answered on 19 Nov 2010, 11:53 AM
Hello Harsh,
The result of the division in this case is of type Int - you are dividing to Int numbers. Please, refer to MSDN for additional information:

http://msdn.microsoft.com/en-us/library/aa691373%28VS.71%29.aspx

Basically, in order to get the correct decimal value, you should divide two decimal numbers:
RadRating radRating = new RadRating();
radRating.ItemCount = 5;
radRating.SelectionMode = RatingSelectionMode.Continuous;
radRating.Precision = RatingPrecision.Exact;
radRating.Value = 5m / 2m;

Regards,
Tsvetie
the Telerik team
Browse the vast support resources we have to jumpstart your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
Tags
Rating
Asked by
harsh
Top achievements
Rank 1
Answers by
Tsvetie
Telerik team
Share this question
or