Questions tagged [maskedtextbox]

A useful .NET control that allows a user to display and edit values based on the mask defined.

The MaskedTextBox class is a .NET/Windows Forms enhanced TextBox control that supports a declarative syntax for accepting or rejecting user input.

For example, in order to get a phone number in the format (505) 55 555 555, MaskedTextBox is preferred.

Using the Mask property, you can specify the following input without writing any custom validation logic in your application:

  • Required input characters.

  • Optional input characters.

  • The type of input expected at a given position in the mask; for example, a digit, or an alphabetic or alphanumeric character.

  • Mask literals, or characters that should appear directly in the MaskedTextBox; for example, the hyphens (-) in a phone number, or the currency symbol in a price.

  • Special processing for input characters; for example, to convert alphabetic characters to uppercase.

For more information, see MaskedTextBox Class (MSDN).

261 questions
6
votes
1 answer

Anybody Know of any jQuery Mask Plugin that works with MVC Unobtrusive Validation?

I've always used the following mask input plugin in my ASP.Net applications: http://digitalbush.com/projects/masked-input-plugin/ Unfortunately, this doesn't play well with MVC unobtrusive validation. Validation fires on every keyup which is…
5
votes
2 answers

Javascript event subscription after UpdatePanel async postback

I Have a problem with jquery event handler after async postback on asp.net page. I read this topic - it's a good solution, but I need a separate function. So I'm using jquery masked plugin. My js code now is:
Mikka
  • 67
  • 2
  • 7
5
votes
3 answers

Hiding the PromptChar for .NET's MaskedTextBox

Is there a way to use MaskedTextBox without displaying the PromptChar? I would like to specify a mask to validate input against, but I don't want any prompt characters to take up space during edit mode. The reason for this is when I want to accept…
Jeremy
  • 1,168
  • 3
  • 17
  • 31
4
votes
4 answers

Adding a format to the TextBox in asp.net

I need to format an asp.net text box in such a way that it accepts the user input only in the form of ### - ### - ### (#:numerics only). Suggestions or answers please.
Shweta
  • 129
  • 1
  • 3
  • 10
4
votes
1 answer

How to use built-in editors for a exposed properties in User Controls - Mask Property Editor Issue

I think there is a simple solution for my stupid question but I just can't solve it today. I have a User Control that has a MaskedTextBox Control in itself. I have also exposed a few of its properties for the user to modify. One of these properties…
Dino
  • 467
  • 1
  • 5
  • 14
4
votes
0 answers

KendoUI masked textbox password feature

How can we get the password feature for a kendoui masked textbox i.e a star symbol while typing in the textbox.
shyam
  • 101
  • 1
  • 9
4
votes
2 answers

Winforms MaskedTextBox - Reformatting pasted text to match mask

I have a MaskedTextBox control that, in our case, is collecting social insurance (tax) numbers (without a ValidatingType though since the string representation including the mask literals). A social insurance number is 3 groups of 3 digits separated…
Reddog
  • 15,219
  • 3
  • 51
  • 63
4
votes
1 answer

Multiline mask for MaskedTextBox

I have a MaskedTextBox in my Winforms application. I need a multiline mask on it, f.e: "999999\r\n 999999\r\n 999999\r\n 00/00/0000" I read the msdn documentation and was suprised to see that there is no "new line"or something like that. I know…
BudBrot
  • 1,341
  • 2
  • 24
  • 44
4
votes
2 answers

Windows Forms - customizing MaskedTextBox

I need to use basic functionality of the MaskedTextBox. I can get use of the 5 digit mask but there are few things that I want to change. Right now the box is looking like this: and there are two thing I don't like. First - the Prompt char which is…
Leron
  • 9,546
  • 35
  • 156
  • 257
4
votes
1 answer

How to set masked text box values to decimal numbers?

I am new to C# Here i am using masked textbox and set the mask as 00.0. And in database respective field is stored in decimal(3,1) while retrieving to masked text box it will give inaccurate values if i stored 12.3 , 23.8, 45.7 these type of…
rangasathish
  • 595
  • 6
  • 13
  • 25
3
votes
2 answers

C# Input validation for a Textbox: float

This supposedly easy task gave me some headache. I simply want to let the user enter any text that succeeds float.TryParse into a Textboxish control. I could use a normal TextBox and check the Text in some btnOK_Click, but this is obviously lame.…
mafu
  • 31,798
  • 42
  • 154
  • 247
3
votes
1 answer

ASP.NET MaskedEditExtender needs to show mm/dd/yyyy when user clicks on textbox

I am using the MaskedEditExtender control for a textbox field that contains Date of Birth. I want the mask to show "mm/dd/yyyy" when the user clicks on the textbox when it is empty. Right now it only shows "__/_/__"
user31673
  • 13,245
  • 12
  • 58
  • 96
3
votes
2 answers

Prevent spaces in a MaskedTextbox

How can I prevent spaces in a maskedtextbox? Used KeyPress but the e.handled doesnt work. Can somebody direct me to a post that shows how to handle this? The masked textbox is used for ssn. Thanks
Tech Xie
  • 927
  • 4
  • 12
  • 24
3
votes
3 answers

How can I restrict the text entered into an input text element using jQuery?

I have an input text element being used as a jQuery UI datepicker with a custom date format. The date format allows months to be entered in as JAN, FEB, etc and so the constrained input allows all characters to go through. See this question. How can…
John Mills
  • 10,020
  • 12
  • 74
  • 121
3
votes
1 answer

How to set Regex Expression as the Mask for a MaskedTextBox in C#?

I want to set the Mask of MaskedtextBox from Regex expression. Such as i want a valid email, Decimal values and other regex expressions against a MaskedtextBox.
Mobin
  • 4,870
  • 15
  • 45
  • 51
1
2
3
17 18