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

Filtering Columns with datatype double?

10 Answers 196 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Dominik
Top achievements
Rank 1
Dominik asked on 06 Oct 2011, 08:23 AM
Hi

We are using the latest release of the Telerik Gridview control for Silverlight 4 in combination with ria services.
Filtering normally works but we have now encountered a problem with the standard filter control when the datatype is a nullable double:
Upon entering a number the filter control will increase the value by factors (example: value 5.00 would be changed to 500.00). It is therefore not possible to enter the correct value.

What can we do about this? Will there be a fix in the next release?

Thanks for your help.

Dan

10 Answers, 1 is accepted

Sort by
0
Dominik
Top achievements
Rank 1
answered on 10 Oct 2011, 03:23 PM
Have you any idea, how to work around the issue or will it be fixed in the next release? It is very easy to reproduce.

Greetings
0
Dimitrina
Telerik team
answered on 11 Oct 2011, 07:31 AM
Hello Dominik,

 Thank you for this report.

I have created a sample project with a RadGridView. One of its columns is bound to a nullable double property. Unfortunately by running this project I was not able to reproduce the behavior that you have described.

Please check the attached project and let me know how is it different from yours?

Greetings,
Didie
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Dominik
Top achievements
Rank 1
answered on 11 Oct 2011, 06:57 PM
Hi

The issue is easily reproducable in your solution. The first time you filter it works although the value in the textbox changes to 300 when you enter  the value 3 (and not 3.00). However, afterwards, one can no longer correctly filter.

Greetings

Ps: i also tested with the latest release of your controsl. The issue also exists there
0
Dimitrina
Telerik team
answered on 13 Oct 2011, 03:08 PM
Hello Dominik,

When I change the value in the field editor textbox, then instead of '3.00' I get the value '30.00'. I need to delete the '0' myself. 
The field editor for the double value is RadMaskedTextBox.  Unfortunately this is the expected behavior of the RadMaskedTextBox. For the Q3 2011 release we have scheduled to change the filter editor for double to be MaskedNumericInput field, that will allow the direct input of number. 

Until then you could change the Mask of the editor. In order to do this you need to handle FieldFilterEditorCreated event of RadGridView:
private void clubsGrid_FieldFilterEditorCreated(object sender, Telerik.Windows.Controls.GridView.EditorCreatedEventArgs e)
        {
            if (e.Editor is RadMaskedTextBox)
            {
                (e.Editor as RadMaskedTextBox).Mask = "your mask here";
            }
        }

I hope that this is helpful.

Regards,
Didie
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Dominik
Top achievements
Rank 1
answered on 16 Oct 2011, 06:59 PM
Hi

Thanks for your answer. Thats great. However, do you know which mask I have to enter, so that the input is correct for a decimal value.

The target behaviour is as follows: It should be possible to enter two digits after the coma.

Entered:                    result:
1                                1.00     (displaying 1 would also be ok)
2.23                           2.23

In my case, the textbox always multiyplies the displayed value by 100 (example: 3   will be changed to 300.00)
The best (most correct) result i have with a mask == "n0", this way the displayed value is correct but i can no longer enter decimal values, which is not acceptable.

Thanks for your help
0
Dimitrina
Telerik team
answered on 19 Oct 2011, 02:20 PM
Hi Dominik,

 Indeed there is not an appropriate mask. This is definitely a problem. That is why you could change the field editor of the FilteringControl to be RadMaskedNumericInput. As I have mentioned in my previous reply we have scheduled to change the filter editor for double to be MaskedNumericInput field.

There is a new method added to GridViewBoundColumnBase:

public virtual FrameworkElement CreateFieldFilterEditor()
{
    returnFilterEditorFactory.CreateEditor(this.DataType);
}

It gives us a perfect opportunity to replace the default field filter editor with the desired one. I have prepared a sample project on how this could be done.  Please check it and let me know if this solution could be applied to your scenario.

Best wishes,
Didie
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Farkas
Top achievements
Rank 1
answered on 02 Sep 2013, 02:59 PM
Hi,

I'm using raddatagrid with double datatype column, and the dinstinct values are not listed correctly. There are too many decimals however I add the value list, as you see in column.
Can you help, why appear those decimals?

Thanks,
Laszlo
0
Dimitrina
Telerik team
answered on 03 Sep 2013, 04:15 PM
Hello Laszlo,

This seems to be a general issue with the double values displayed in the stock Silverlight ListBox. 

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}").

Regards,
Didie
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
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 >>
0
Josh
Top achievements
Rank 1
answered on 03 Sep 2013, 10:07 PM
If you are able to change the type of your column, I do not believe this problem exists for Decimal datatypes.
0
Dimitrina
Telerik team
answered on 04 Sep 2013, 07:44 AM
Hello,

The problem is only with Double values. If your values are of type Decimal, then they will be displayed fine. 

Regards,
Didie
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
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 >>
Tags
GridView
Asked by
Dominik
Top achievements
Rank 1
Answers by
Dominik
Top achievements
Rank 1
Dimitrina
Telerik team
Farkas
Top achievements
Rank 1
Josh
Top achievements
Rank 1
Share this question
or