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

Insert mode for RadMaskedEditBox

5 Answers 66 Views
MaskedEditBox
This is a migrated thread and some comments may be shown as answers.
Ralf
Top achievements
Rank 1
Ralf asked on 12 Jul 2011, 08:53 PM
Hello.
It seems that the RadMaskedEditBox allways works in replace mode.What I want to do is the following:
On the Enter-Event I select the whole contents of the control. When the user types the first character, the old contents should be replaced by the character he typed. But that doesn't happen. Instead the first character is replaced by the user input. If the former content had 4 characters and the user only types 2 characters the rest of the old input remains in the control.
Sometimes replacement starts on the second character, although the whole content was selected.

Is there a way to replace the old content completely when the user types the first character?

Ralf

5 Answers, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 15 Jul 2011, 09:41 AM
Hello Ralf,

Thank you for writing.

RadMaskedEditBox always restricts user to type only the allowed characters that fits to the mask pattern and for many masks we cannot clear the initial/pattern value - for example for mask n3 (0.00) we always have two zeros after the decimal sign or for DateTime mask we always have an initial Date that cannot be removed.

Do not hesitate to contact us if you have other questions.

All the best,
Peter
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

0
Ralf
Top achievements
Rank 1
answered on 15 Jul 2011, 09:47 AM
Hello Peter.

Thank you for the explanation.
So I've to find a workaround, because the EditBox's I'm talking about allow only simple string input. No decimals or something special formatted.

Greetings,
Ralf
0
Peter
Telerik team
answered on 20 Jul 2011, 09:13 AM
Hi Ralf,

Thank you for the feedback.

In this case I would like to suggest using the regular RadTextBox for simple text editing or continue using RadMaskedEditBox, but set the Mask property to None.

You should also subscribe to the Enter event and on this event select whole text, for example:

private void radMaskedEditBox1_Enter(object sender, EventArgs e)
{
            this.radMaskedEditBox1.SelectAll();


I hope this helps.

All the best,
Peter
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

0
Brendan
Top achievements
Rank 1
answered on 06 Mar 2015, 04:02 PM
I had a need to do the same thing in clearing the RMEB.  I pull data from a db and populate the fields in RMEB's.  If there is no data I do not want the current/any date shown.  Here is my solution.

1. Clear all RMEB fields by setting the RMEB.MaskedEditBoxElement.TextBoxItem to ""
2. Check for Null date and only populate control if Date field value IsNot Null

If you set the ctl.text for a Date mask RMEB to Null, today's date will be filled in.  So check for null and don't set it if null.

For Each ctl As RadMaskedEditBox In lstCtls     'loop thru RMEB's on form
 
        ctl.MaskedEditBoxElement.TextBoxItem.Text = ""     'clear textboxItem info first
 
            Dim sVal As String = Nothing
            Try
                sVal = sRow.Item(sFldName)    'look for datarow field based on ctl.name
            Catch e As Exception       'catch nulls/nothings
            End Try
            If sVal IsNot Nothing Then   'If we set date to null, default date will show up - so don't do it
                ctl.Text = sVal         'set text here
                ctl.MaskedEditBoxElement.TextBoxItem.ToolTipText = sFldName     'add tooltip
            End If
        End If
    End If
Next
0
Hristo
Telerik team
answered on 11 Mar 2015, 11:12 AM
Hi Brendan,

Thank you for sharing your solution with our community.

Your Telerik points have been updated accordingly.

Regards,
Hristo Merdjanov
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
MaskedEditBox
Asked by
Ralf
Top achievements
Rank 1
Answers by
Peter
Telerik team
Ralf
Top achievements
Rank 1
Brendan
Top achievements
Rank 1
Hristo
Telerik team
Share this question
or