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

Negative value for mask in MaskedTextBox

7 Answers 645 Views
Input
This is a migrated thread and some comments may be shown as answers.
Ferdinand
Top achievements
Rank 1
Ferdinand asked on 30 Sep 2010, 08:16 AM
Hi,
how can I build a mask for the MasedTextBox where it is possible to enter a numeric value from -999 to 999? I cannot use the NumericTextBox for this purpose.
Best regards.
Ferdinand

7 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 30 Sep 2010, 08:41 AM
Hello,

Try the following Mask/DisplayMask properties to achieve this.

<telerik:RadMaskedTextBox ID="RadMaskedTextBox2" runat="server" Mask="<-999..999>"
    DisplayMask="<-999..999>">
</telerik:RadMaskedTextBox>

Documentation on Masks:
http://www.telerik.com/help/aspnet-ajax/input_radmaskedtextboxmasks.html


-Shinu.
0
Ferdinand
Top achievements
Rank 1
answered on 30 Sep 2010, 08:53 AM
Hi,
thanks for the reply. I already tried that but all that is shown is 0000 (for <-999..999>) and it is not possible to set a "-" for the first "0". This always remains "0" (whatever you enter).
So, any other ideas?
0
Cori
Top achievements
Rank 2
answered on 30 Sep 2010, 04:42 PM
Hello Ferdinand,

Why can't you use a RadNumericTextBox for your situation? All you would need to do is set MinValue="-999" and MaxValue="999". Is that not what you want it to do?
0
Dominik Gierse
Top achievements
Rank 1
answered on 01 Oct 2010, 07:17 AM
Hi.
Ferdinand is on vacation and I try to resolve this problem now...
I have to use the same TextBox as time input. With the masked TextBox I only have to change the mask and I can reuse it.
Best regards.
0
Cori
Top achievements
Rank 2
answered on 01 Oct 2010, 02:40 PM
Hello Uwe,

This is a very strange issue and it seems to be an issue with the control itself. The only way I was able to get it to display the negative sign was doing the following steps:

1. Entered "-999". It shows "0999".
2. I moved to the right of the first 0 and pressed BACKSPACE and then entered "-". It then showed "-999".

I believe this is some sort of bug with the RadMaskedTextBox or its inability to do negative to positive number ranges.
0
Cori
Top achievements
Rank 2
answered on 01 Oct 2010, 02:56 PM
Hello Uwe,

This is the only mask that I can see working for your situation. Although it has some faults, like if they click SPACE, it will automatically enter the negative sign, but otherwise if they just type in the number it will work correctly. It will not add that extra "0".

<telerik:RadMaskedTextBox ID="RadMaskedTextBox1" runat="server" DisplayMask="<-|#><0..999>"
            Mask="<-|#><0..999>" Width="125px" AllowEmptyEnumerations="True">
        </telerik:RadMaskedTextBox>

I hope that helps.
0
Dominik Gierse
Top achievements
Rank 1
answered on 01 Oct 2010, 03:20 PM
Thanks Cori,
I think that should do.

Uwe
Tags
Input
Asked by
Ferdinand
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Ferdinand
Top achievements
Rank 1
Cori
Top achievements
Rank 2
Dominik Gierse
Top achievements
Rank 1
Share this question
or