GridView Filter shows erroneous values for rounded decimal values

2 posts, 0 answers
  1. Rob
    Rob avatar
    4 posts
    Member since:
    Oct 2012

    Posted 30 May 2014 Link to this post

    I have created a basic RadGridView with one of the bindable values being a double. When populating the collection I just create a random double that I round to 2 decimal values. This shows up in the GridView perfectly. But when I select the filter for this column the values are erroneous to what should be displayed. So say I have a row value of 39.02, then the filter option for this is 39.0200004577637. See attach file.

    Why is it doing this ?

    Cheers ... Rob.
  2. Dimitrina
    Dimitrina avatar
    3769 posts

    Posted 02 Jun 2014 Link to this post

    Hello Rob,

    Indeed, your observations are right.

    This is actually a known issue with the decimal values displayed in the stock Silverlight ListBox that is used inside the FilteringControl for displaying DistinctValues. 

    What you can do to avoid such inconvenience is to define a StringFormat for the Binding, or a DataFormatString for the column (for example DataFormatString="{}{0:N2}").

    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
Back to Top