How to remove zero from RadMaskedTextBox when enter value.

6 posts, 0 answers
  1. Purushothaman
    Purushothaman avatar
    23 posts
    Member since:
    Jul 2011

    Posted 20 Jun 2012 Link to this post

    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.
  2. Lancelot
    Lancelot avatar
    251 posts
    Member since:
    Jul 2012

    Posted 22 Jun 2012 Link to this post

    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 
  3. Purushothaman
    Purushothaman avatar
    23 posts
    Member since:
    Jul 2011

    Posted 25 Jun 2012 Link to this post

    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.
  4. Lancelot
    Lancelot avatar
    251 posts
    Member since:
    Jul 2012

    Posted 25 Jun 2012 Link to this post

    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
  5. Purushothaman
    Purushothaman avatar
    23 posts
    Member since:
    Jul 2011

    Posted 27 Jun 2012 Link to this post

    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.
  6. Lancelot
    Lancelot avatar
    251 posts
    Member since:
    Jul 2012

    Posted 28 Jun 2012 Link to this post

    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
Back to Top