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

Can't enter Negative values

7 Answers 849 Views
MaskedInput (Numeric, DateTime, Text, Currency)
This is a migrated thread and some comments may be shown as answers.
Koren
Top achievements
Rank 1
Koren asked on 25 Jun 2012, 06:00 PM
I am upgrading from Q3 2011 to Q2 2012 and ran into a problem with the numeric input.  I cannot enter a negative value into my textboxes.  It doesn't throw an error - it just ignores the negative sign.  I have tried the number pad and the regular keyboard and I have tried entering the negative first and entering it last.  Nothing seems to work.
See below for an example of one of the text boxes.  I checked the value in the validator and it is positive there so it isn't the validator changing the value.

<telerik:GridViewDataColumn DataMemberBinding="{Binding Units}" DataFormatString="{}{0:f2}" IsFilterable="False" Width="80"
                                            IsReadOnlyBinding="{Binding HideUnits}">
                    <telerik:GridViewDataColumn.Header>
                        <TextBlock Text="Units" TextWrapping="Wrap" />
                    </telerik:GridViewDataColumn.Header>
                    <telerik:GridViewDataColumn.CellEditTemplate>
                        <DataTemplate>                                                      
                            <telerikInput:RadMaskedNumericInput x:Name="txtUnits" Mask="#9.2"
                                                                SpinMode="None" IsClearButtonVisible="False" SelectionOnFocus="SelectAll"
                                                                KeyboardNavigation.TabNavigation="Local" TextMode="PlainText"                                                               
                                                                Validation.ErrorTemplate="{StaticResource TextBoxErrorTemplate}" 
                                                                 >
                                <telerikInput:RadMaskedNumericInput.Value>
                                    <Binding Path="Units" Mode="TwoWay" UpdateSourceTrigger="LostFocus">
                                        <Binding.ValidationRules>
                                            <imKASHelper:DoubleValidationRule Min="-100000000.00" Max="100000000.00" />
                                        </Binding.ValidationRules>
                                    </Binding>
                                </telerikInput:RadMaskedNumericInput.Value>
                            </telerikInput:RadMaskedNumericInput>
 
                        </DataTemplate>
                    </telerik:GridViewDataColumn.CellEditTemplate>
                </telerik:GridViewDataColumn>

7 Answers, 1 is accepted

Sort by
0
Tina Stancheva
Telerik team
answered on 28 Jun 2012, 02:01 PM
Hi Koren,

Please accept our apology for this inconvenience. This is a known issue that was introduced with the Q2 2012 release. However, we've already addressed it in our latest internal build.

And until the next official release is out, you can set the minimum and maximum value of the control as a workaround:
<telerikInput:RadMaskedNumericInput
                xmlns:ext="clr-namespace:Telerik.Windows.Controls.MaskedInput;assembly=Telerik.Windows.Controls.Input"

                x:Name
="txtUnits"
                ext:MaskedInputExtensions.Maximum
="2147483647"
                ext:MaskedInputExtensions.Minimum
="-2147483648"
                IsClearButtonVisible
="False"
                KeyboardNavigation.TabNavigation
="Local"
                Mask
="#9.2"

                SelectionOnFocus
="SelectAll"
                SpinMode
="None

                TextMode
="PlainText"

                Validation.ErrorTemplate
="{StaticResource TextBoxErrorTemplate}"

                Value
="5">
...
        </telerikInput:RadMaskedNumericInput>

Give this a try and let us know if it helps.

Kind regards,
Tina Stancheva
the Telerik team

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

0
Koren
Top achievements
Rank 1
answered on 10 Jul 2012, 03:05 PM
This helped a little.  However, I can't type in the negative sign first like we could before.  I can type in 3- but not -3.  This will be confusing for our users who are used to it working either way.
Thanks.
0
Petar Mladenov
Telerik team
answered on 13 Jul 2012, 06:38 AM
Hello Koren,

 In a sample scenario am not able to reproduce such issue (you can heck out the attached sample).
Do you use custom culture? If yes, you can check out this msdn page describing the different CurrencyNegativePatterns you can have. In the code behind of the attached project you can also see how to define custom culture (the commented lines in the MainWindow.xaml.cs).

Greetings,
Petar Mladenov
the Telerik team

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

0
Koren
Top achievements
Rank 1
answered on 13 Jul 2012, 01:54 PM
The sample you sent did not have the numeric input in a column of a telerik gridview. 

here is an example... 

<telerik:GridViewDataColumn DataMemberBinding="{Binding Units}" DataFormatString="{}{0:f2}" IsFilterable="False" Width="80"
                                            IsReadOnlyBinding="{Binding HideUnits}">
                    <telerik:GridViewDataColumn.Header>
                        <TextBlock Text="Units" TextWrapping="Wrap" />
                    </telerik:GridViewDataColumn.Header>
                    <telerik:GridViewDataColumn.CellEditTemplate>
                        <DataTemplate>                                                      
                            <telerikInput:RadMaskedNumericInput x:Name="txtUnits" Mask="#9.2"
                                                                SpinMode="None" IsClearButtonVisible="False" SelectionOnFocus="SelectAll"
                                                                KeyboardNavigation.TabNavigation="Local" TextMode="PlainText"                                                               
                                                                Validation.ErrorTemplate="{StaticResource TextBoxErrorTemplate}" 
                                                                telerikMaskedInput:MaskedInputExtensions.Minimum="-2147483648"
                                                                telerikMaskedInput:MaskedInputExtensions.Maximum="2147483648">
                                <telerikInput:RadMaskedNumericInput.Value>
                                    <Binding Path="Units" Mode="TwoWay" UpdateSourceTrigger="LostFocus">
                                        <Binding.ValidationRules>
                                            <imKASHelper:DoubleValidationRule Min="-100000000.00" Max="100000000.00" />
                                        </Binding.ValidationRules>
                                    </Binding>
                                </telerikInput:RadMaskedNumericInput.Value>
                            </telerikInput:RadMaskedNumericInput>
 
                        </DataTemplate>
                    </telerik:GridViewDataColumn.CellEditTemplate>
                </telerik:GridViewDataColumn>
0
Nathan J Pledger
Top achievements
Rank 2
answered on 16 Jul 2012, 01:39 PM
Hi Tina and Petar,

I am also having this issue.

My XAML:

<telerik:RadMaskedCurrencyInput FormatString="#9.2"  SelectionOnFocus="SelectAll"  SpinMode="None" UpdateValueEvent="PropertyChanged"
                                                                Value="{Binding NetPricePerUnit, Mode=TwoWay, UpdateSourceTrigger=Explicit}" />


I find it concerning that your product has essentially regressed, so your unit testing/use of your own test tools is perhaps not as stringent as it could be?

However, that aside, without any fixes/workarounds that ultimately may impact the quality of our product, when can we expect a fix?

Thanks,

Nathan
0
Tina Stancheva
Telerik team
answered on 18 Jul 2012, 12:39 PM
Hello guys,

Firstly I want to assure you that this issue is already fixed and you can both test it with the latest internal build. The fix will be officially out with the upcoming Q2 2012 SP1 release.

@Nathan - in the meantime you can use the same workaround I suggested to Koren:
<telerik:RadMaskedCurrencyInput xmlns:telerikMaskedInput="clr-namespace:Telerik.Windows.Controls.MaskedInput;assembly=Telerik.Windows.Controls.Input"
                                SelectionOnFocus="SelectAll"
                                SpinMode="None"
telerikMaskedInput:MaskedInputExtensions.Maximum="2147483648"
telerikMaskedInput:MaskedInputExtensions.Minimum="-2147483648"
                                UpdateValueEvent="PropertyChanged"
                                Value="{Binding NetPricePerUnit,
                                                Mode=TwoWay,
                                                UpdateSourceTrigger=Explicit}" />
I also noticed that you've defined a FormatString for the control - by default the Mask of the CurrencyInput control is #9.2 so you don't really need to apply any kind of FormatString properties.

@Koren - I wasn't able to reproduce the issue but I noticed that the Width you've applied on the GridViewDataColumn is too small and it can't display the minus sign in front of the control. So I changed that Width to 100 and I was able to successfully set and see the minus sign as soon as I enter the cell for editing. I attached my solution so that you can have a look at it and let me know if it works for you.

All the best,
Tina Stancheva
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Koren
Top achievements
Rank 1
answered on 18 Jul 2012, 06:07 PM
That appears to work.  I will have to adjust the width of all my grid columns with numeric input.  The negative must have been right beside the number before rather than at the front like it is now.
Thanks!
Tags
MaskedInput (Numeric, DateTime, Text, Currency)
Asked by
Koren
Top achievements
Rank 1
Answers by
Tina Stancheva
Telerik team
Koren
Top achievements
Rank 1
Petar Mladenov
Telerik team
Nathan J Pledger
Top achievements
Rank 2
Share this question
or