Click here to Skip to main content
15,848,319 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
How to Fill the Mask Text box using asp .net

My Mask Text box is like this 

<uc1:MaskTextBox ID="msk_test" runat="server" InputMask="NNNN/NNNN/NNNN"></uc1:MaskTextBox>
and i am not getting the property msk_test.Text

What I have tried:

msk_test.InputMask = "5555/5555/5555";

It is showing blank
Updated 6-Sep-18 5:05am
[no name] 6-Sep-18 8:36am    
What do you mean by fill? Are you not able to assign values to this masked control as user input / programmatically?
Khan Sameer 10-Sep-18 22:39pm    
Yes, I am not able to assign value to this mask textbox i have tried this
msk_test.InputMask = "5555/5555/5555";
It is showing blank. How to refill it.

1 solution

MaskedTextBox is essentially an extender that attaches to a TextBox control to restrict the kind of text that can be entered. If you are referring to a AJAXControlToolkit MaskEditExtender control, then you have to set the TargetControlID pointing to the actual TextBox that you want to apply the mask. For example:

<cc1:MaskedEditExtender ID="MaskedEditExtender1" runat="server" TargetControlID="TextBox1" .../>

You can then use the .Text property of TextBox1 to get the actual value being masked.

string theValue = TextBox1.Text;

More info, see: AJAX Control ToolKit Masked Edit Tutorial Example in ASP.NET C# - Ajax Tutorials, Tricks, and Code Examples[^]
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900