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

How to remove zero from RadMaskedTextBox when enter value.

5 Answers 225 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Purushothaman
Top achievements
Rank 2
Purushothaman asked on 20 Jun 2012, 12:05 PM
Hi,

I am using telerik:RadMaskedTextBox in my project like as below,

<telerik:RadMaskedTextBox
                    x:Name="txtGoal"
                    HorizontalAlignment="Stretch"
                    Margin="5,5,5,5"
                    Mask="d"
                    MaskType="Numeric"
                    Value="{Binding Path=GoalData, Mode=TwoWay,TargetNullValue=0}">
</telerik:RadMaskedTextBox>

When run my project that RadMaskedTextBox control shows 0 ( for example).Now i want to like enter value 1.so just i double click on txtGoal control for highlight (Step 1)  and press 1(Step 2).Notice i will show with that previous 0 means 10.please refer attachment file. In Google chrome and IE.

5 Answers, 1 is accepted

Sort by
0
Lancelot
Top achievements
Rank 1
answered on 22 Jun 2012, 03:40 PM
Hi Purushothaman,

I was unable to reproduce your issue using the code you provide. I suspect the 0 value is coming from your GoalData value.  I would clear GoalData upon the Loading event and see if it is still present.

Good Luck,
Lancelot 
0
Purushothaman
Top achievements
Rank 2
answered on 25 Jun 2012, 07:53 AM
Thankyou for your replay.But now i am getting this error in Google Crome.Now i am not getting in IE.Please let me know how to handle this issue.
0
Lancelot
Top achievements
Rank 1
answered on 25 Jun 2012, 02:11 PM
The screenshots you attached are the "About" dialog windows. This is when you ask IE or Chrome what is it's current version. I'm not sure how you are doing this from within your application. Do you have any additional information about how you are ending up here. (ie the steps you took to get there).

Also, are you debugging your application? Use breakpoints to determine where this is happening.

Lancelot
0
Purushothaman
Top achievements
Rank 2
answered on 28 Jun 2012, 04:43 AM
Hi,

I attached IE and Chrome Version details.I am getting only in Chrome only.So i removed TargetNullValue=0 from xaml code 
fixed like as below.

In XAML,

<telerik:RadMaskedTextBox
                    x:Name="txtGoal"
                    HorizontalAlignment="Stretch"
                    Margin="5,5,5,5"
                    Mask="d"
                    MaskType="Numeric"
                    Value="{Binding Path=GoalData, Mode=TwoWay}">
</telerik:RadMaskedTextBox>

In VB Code,

Form_Load()

        If GoalData Is Nothing Then
            txtGoal.MaskedText = 0
        End If



Is this correct format or not.Please let me know.
0
Lancelot
Top achievements
Rank 1
answered on 28 Jun 2012, 03:53 PM
Hi Purushothaman,

I looked a little deeper into what may be cause this problem for you. The main one I found is that you are using the old version of the control. RadMaskedTextBox has been discontinued and a newer, more powerful control has been released in it's place. You should use RadMaskedInput controls instead. 

Let me explain why it is better, the RadMaskedTextBox has the following problems:

- there are numeric/currency masks which cause unexpected behavior - exceptions, incorrectly parsed value or binding issues in the MaskedTextBox control
- the RadMaskedTextBox doesn't support null values
- the RadMaskedTextBox doesn't support RegEx and the customer demand for that feature was very high
- there are issues with editing DateTime values
- the RadMaskedTextBox can't work correctly with all cultures
- the spinning behavior causes exceptions in certain scenarios

The big one here for you is #2, you may have a null value in your project.

The new control you'll want to use instead is the MaskedNumericInput control. It is designed to handle many scenarios and will work exactly as you need it to in your project. If you click on that link, you'll be brought to the documentation for the specific control, however there are three other RadMaskedInput controls available; RadMaskedTextInputRadMaskedCurrencyInput and RadMaskedDateTimeInput


Good Luck,
Lancelot
Tags
General Discussions
Asked by
Purushothaman
Top achievements
Rank 2
Answers by
Lancelot
Top achievements
Rank 1
Purushothaman
Top achievements
Rank 2
Share this question
or