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

RadMaskedTextBox missing 'MaskType' property

5 Answers 71 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Brad
Top achievements
Rank 1
Brad asked on 15 Aug 2011, 03:19 AM
Hi

I am trying to use the RadMaskedTextBox for the first time and have hit an issue. Where is the MaskType property?

RadMaskedTextBox m1 = new RadMaskedTextBox();
m1.ID = ID;
m1.Mask = "d";
//m1.MaskType  << No such property
c2.Controls.Add(m1);

(where c2 is a TableCell() control)

Yet it is clearly documented on this page as a property of the RadMaskedTextBox

http://www.telerik.com/help/wpf/radmaskedtextbox-features-numeric-mask.html

Here is a sample of the code from that page.
<telerik:RadMaskedTextBox MaskType="Numeric" Mask="d" Value="111.234" Margin="0,5,0,10" />

How do I set the MaskType on a dynamically created RadMaskedTextbox?

Note: I tried this

m1.Attributes.Add("MaskType", "Numeric");

Ugly and heavy handed way to do something that should be a property of the control. Does not work however.

To make matters worse, the textbox that gets written to the page has the letter 'd' in it, AND it cannot be edited..

The textbox input is disabled.

What's going on?

How do I add a dynamically created RadMaskedTextBox to a page, set it's MaskType property and have a functioning textbox once the page loads?








5 Answers, 1 is accepted

Sort by
0
Brad
Top achievements
Rank 1
answered on 15 Aug 2011, 04:59 AM
My bad.. The help I was looking at on the Telerik site is for RadControls for WPF. I'm using the ajax controls.

Still, I could use some pointers for getting this control working.
0
Princy
Top achievements
Rank 1
answered on 16 Aug 2011, 08:52 AM
Hello Brad,

You can achieve this by setting the Mask property for RadNumericTextBox as shown below.
C#:
protected void Page_Load(object sender, EventArgs e)
{
 RadMaskedTextBox maskedBox = new RadMaskedTextBox();
 maskedBox.ID = "RadMaskedTextBox1";
 maskedBox.Mask = "(###)- ####";
}

Also check the following help documentation which explains more about this.
RadmaskedTextBox Basics.

Thanks,
Princy.
0
satish
Top achievements
Rank 1
answered on 22 Aug 2013, 12:27 PM

Hello Princy,

I have added radmaskedtextbox dynamically using code given below. Control is added successfully but mask property was not working. Radmaskedtextbox is behaving like normal text box.

 var maskedTextBox = new RadMaskedTextBox();
 maskedTextBox.ID = "Textbox_Date";
 maskedTextBox.Mask = "##/##/####";
  Page.Controls.Add(maskedTextBox);


Please help me.

Thanks in advance.

Thanks and best regards,
satish
0
Shinu
Top achievements
Rank 1
answered on 23 Aug 2013, 04:51 AM
Hi satish,

Please have a look into the following code I tried which works fine at my end.

C#:
RadMaskedTextBox RadMaskedTextBox1 = new RadMaskedTextBox();
RadMaskedTextBox1.Mask = "##/##/####";
this.form1.Controls.Add(RadMaskedTextBox1);

Thanks,
Shinu.
0
satish
Top achievements
Rank 1
answered on 23 Aug 2013, 05:21 AM

Hi Shinu,

It is working fine. Thank you so much.

Thanks and best regards,
Satish
Tags
General Discussions
Asked by
Brad
Top achievements
Rank 1
Answers by
Brad
Top achievements
Rank 1
Princy
Top achievements
Rank 1
satish
Top achievements
Rank 1
Shinu
Top achievements
Rank 1
Share this question
or