half rad star not setting in code behind

2 posts, 0 answers
  1. harsh
    harsh avatar
    4 posts
    Member since:
    Nov 2010

    Posted 16 Nov 2010 Link to this post

    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.

     

  2. Tsvetie
    Admin
    Tsvetie avatar
    1517 posts

    Posted 19 Nov 2010 Link to this post

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