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

RadGrid NotBetween not working correctly

1 Answer 44 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Diego
Top achievements
Rank 1
Diego asked on 05 Sep 2019, 03:03 PM

Hi,

We've been doing tests with the Trial 2019 version of Telerik and we have the following problem:

We have a string type column that can contain both string and decimal values depending on the information that the user needs to display. When the user needs to filter by between (for example, between 2 and 20), the filter works perfectly and the proper values are being displayed.

However, when the NotBetween filter is used, some values are being filtered out while others are being displayed even though they're inside the range, if we use "NotBetween" for values 0 and 10, values like 2,21 and 4,556 are being shown despite clearly being inside the range.

Is there any fix for this problem or is filtering String columns by NotBetween not an acceptable use case? Thank you for your help.

1 Answer, 1 is accepted

Sort by
0
Attila Antal
Telerik team
answered on 10 Sep 2019, 10:32 AM

Hi Diego,

In programming, comparing strings does not work the same way as comparing numbers. If you wish to compare the string values as if they were numbers, you will need to convert them to numbers first, then compare them.

The same applies in your case. For the sake of handling the data by its type, RadGrid has built-in columns such as  Numeric column, Date, Image, Link and more: RadGrid - Column Types.

In order to make the filter handle the data accord to its type, you can try using GridNumericColumn, or setting the DataType property of the column to System.Decimal. In some cases, you may also want to bind decimal type of data to the column.

 

I hope this will help resolve the issue.

 

Kind regards,
Attila Antal
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
Grid
Asked by
Diego
Top achievements
Rank 1
Answers by
Attila Antal
Telerik team
Share this question
or