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

Strange Behavior of RadMaskedEditBox

7 Answers 128 Views
MaskedEditBox
This is a migrated thread and some comments may be shown as answers.
Eastern
Top achievements
Rank 1
Eastern asked on 15 Dec 2010, 11:47 PM
hi,

i am using inheriting RadMaskedEditBox in a user control with Mask="D" for numeric only text boxes.
the strange behavior is that the textbox text becomes "0" when the control lost focus.
i traced it the problem arises from RadMaskComplexEditBehavior.UpdateUI() the change the RadMaskTextBox.ParentText to "0" and problem starts!

how can i solve this problem ?

thanks.

7 Answers, 1 is accepted

Sort by
0
Richard Slade
Top achievements
Rank 2
answered on 16 Dec 2010, 12:20 PM
Hello Eastern,

Could you clarify a couple of points please.
In my case, a RadMaskedEditBox with the following settings:
Me.RadMaskedEditBox.Mask = "D"
Me.RadMaskedEditBox.MaskType = MaskType.Numeric

has a default value of 0. This is what I would expect as it only accepts numeric input.
If I change this to (e.g.) 44 and tab away, then the text still reads 44.

Is this what happens for you too?

For reference I am using the latest 2010 Q3 SP1 version.
Richard
0
Eastern
Top achievements
Rank 1
answered on 16 Dec 2010, 01:50 PM
hi richard,

a bit different, actually i set my desired number in the form_load into the textbox not entered by hand.

Form_Load:
maskedTextBox1.Text = "14"

0
Accepted
Richard Slade
Top achievements
Rank 2
answered on 16 Dec 2010, 01:59 PM
Hi Eastern,

The reason that this happens (I think), is that the text property is taken from the value property. You have changed the text but not the value so when you tab away, the text is updated to match the value. Please try setting
maskedTextBox1.Value = 14

instead of the text, and you should find all is ok.
Hope that helps, but let me know if you need more information
Richard
0
Eastern
Top achievements
Rank 1
answered on 16 Dec 2010, 02:36 PM
actually, i have a new implementation of Value in my inherited user control , is it ok?
0
Accepted
Richard Slade
Top achievements
Rank 2
answered on 16 Dec 2010, 02:53 PM
I think it will be fine. Give it a go (using .value rather than .text) and let me know if that's ok
thanks
Richard
0
Eastern
Top achievements
Rank 1
answered on 16 Dec 2010, 03:00 PM
i used this piece of code in my implementation of  Text and Value :

base.Value = value;

and everything works fine now ;)
i marked your helpful post as answer.

Thanks Richard.
0
Richard Slade
Top achievements
Rank 2
answered on 16 Dec 2010, 03:01 PM
Glad to have been able to help
All the best
Richard
Tags
MaskedEditBox
Asked by
Eastern
Top achievements
Rank 1
Answers by
Richard Slade
Top achievements
Rank 2
Eastern
Top achievements
Rank 1
Share this question
or