RadDataFilter with German Values (0,01)

2 posts, 0 answers
  1. Peter
    Peter avatar
    37 posts
    Member since:
    Dec 2011

    Posted 11 Sep 2013 Link to this post

    We are trying to build a FilterDestriptor with FilterValues in German format for numeric decimal Values.

    In German Culture ("de-DE") the double value 0.1 is written 0,1 (with comma), but FilterDesriptor will not parse this correctly although the thread's CurrentCulture is German. So "0,1" will be parsed incorrectly as 1.0D when using the constructor to build a FilterDescriptor:

    FilterDescriptor mydescriptor = FilterDescriptor(FilterMember, FilterOperator, "0,1", FilterIsCaseSensitive);

    Where can I set the culture to use for number conversion???
  2. Rossen Hristov
    Rossen Hristov avatar
    2478 posts

    Posted 12 Sep 2013 Link to this post


    If the FilterDescriptor.Value is supposed to be a .NET number (i.e. double) -- supply an actual .NET number -- not a string. There is no one to parse a string and convert in into a number for you. You can do that in your code if you need to.

    FilterDescriptor mydescriptor = FilterDescriptor(FilterMember, FilterOperator, 0.1, FilterIsCaseSensitive);
    Obtaining this double value of 0.1 is your task. For example, you can use Double.TryParse which will respect the current culture and parse the German string. Pass the actual .NET double to the FilterDescriptor and will be well.
    In the end -- all that .NET cares about is this double value. How it was obtained is none of its concern.
    I hope this helps.

    Rossen Hristov
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
Back to Top