# MaskedTextBox

Namespace: **Wisej.Web**

Assembly: **Wisej.Framework** (4.0.0.0)

* [Control](https://docs.wisej.com/api/wisej.web/general/control)
  * [TextBoxBase](https://docs.wisej.com/api/wisej.web/editors/wisej.web.textboxbase)
    * [MaskedTextBox](https://docs.wisej.com/api/wisej.web/editors/maskedtextbox)

Uses a mask to distinguish between proper and improper user input.

{% tabs %}
{% tab title="C#" %}

```csharp
public class MaskedTextBox : TextBoxBase
```

{% endtab %}

{% tab title="VB.NET" %}

```visual-basic
Public Class MaskedTextBox
    Inherits TextBoxBase
```

{% endtab %}
{% endtabs %}

The MaskedTextBox class is an enhanced [TextBox](https://docs.wisej.com/api/wisej.web/editors/wisej.web.textbox) control that supports a declarative syntax for accepting or rejecting user input. Using the [Mask](#mask) property, you can enforce the following input types 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.
* Special processing for input characters; for example, to convert alphabetic characters to uppercase.

When a [MaskedTextBox](https://docs.wisej.com/api/wisej.web/editors/maskedtextbox) control is displayed at run time, it represents the mask as a series of prompt characters and optional literal characters. Each editable mask position, representing a required or optional input, is shown with a single prompt character. For example, the number sign (#) is often used as a placeholder for a numeric character input. You can use the [PromptChar](#promptchar) property to specify a custom prompt character. The [HidePromptOnLeave](#hidepromptonleave) property determines if the user sees the prompt characters when the control loses input focus

## Constructors

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) MaskedTextBox()

Initializes a new instance of the [MaskedTextBox](https://docs.wisej.com/api/wisej.web/editors/maskedtextbox) class using defaults.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) MaskedTextBox(onTextChanged)

Initializes a new instance of the [MaskedTextBox](https://docs.wisej.com/api/wisej.web/editors/maskedtextbox) class with specific initial settings.

| Name              | Type                                                                                | Description                                                                                  |
| ----------------- | ----------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- |
| **onTextChanged** | [Action\<Object, EventArgs>](https://docs.microsoft.com/dotnet/api/system.action-2) | Handler for the [TextChanged](https://docs.wisej.com/api/general/control#textchanged) event. |

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) MaskedTextBox(mask, onTextChanged)

Initializes a new instance of the [MaskedTextBox](https://docs.wisej.com/api/wisej.web/editors/maskedtextbox) class with specific initial settings.

| Name              | Type                                                                                | Description                                                                                  |
| ----------------- | ----------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- |
| **mask**          | [String](https://docs.microsoft.com/dotnet/api/system.string)                       | Initial [Mask](#mask).                                                                       |
| **onTextChanged** | [Action\<Object, EventArgs>](https://docs.microsoft.com/dotnet/api/system.action-2) | Handler for the [TextChanged](https://docs.wisej.com/api/general/control#textchanged) event. |

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) MaskedTextBox(label, mask, onTextChanged)

Initializes a new instance of the [MaskedTextBox](https://docs.wisej.com/api/wisej.web/editors/maskedtextbox) class with specific initial settings.

| Name              | Type                                                                                | Description                                                                                                           |
| ----------------- | ----------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------- |
| **label**         | [String](https://docs.microsoft.com/dotnet/api/system.string)                       | The initial text to display in the [MaskedTextBox](https://docs.wisej.com/api/wisej.web/editors/maskedtextbox) label. |
| **mask**          | [String](https://docs.microsoft.com/dotnet/api/system.string)                       | The initial [Mask](#mask) value.                                                                                      |
| **onTextChanged** | [Action\<Object, EventArgs>](https://docs.microsoft.com/dotnet/api/system.action-2) | Handler for the [TextChanged](https://docs.wisej.com/api/general/control#textchanged) event.                          |

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) MaskedTextBox(location, size, onTextChanged)

Initializes a new instance of the [MaskedTextBox](https://docs.wisej.com/api/wisej.web/editors/maskedtextbox) class with specific initial settings.

| Name              | Type                                                                                | Description                                                                                                            |
| ----------------- | ----------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- |
| **location**      | [Point](https://docs.microsoft.com/dotnet/api/system.drawing.point)                 | The location of the [MaskedTextBox](https://docs.wisej.com/api/wisej.web/editors/maskedtextbox) on its parent control. |
| **size**          | [Size](https://docs.microsoft.com/dotnet/api/system.drawing.size)                   | The size of the [MaskedTextBox](https://docs.wisej.com/api/wisej.web/editors/maskedtextbox).                           |
| **onTextChanged** | [Action\<Object, EventArgs>](https://docs.microsoft.com/dotnet/api/system.action-2) | Handler for the [TextChanged](https://docs.wisej.com/api/general/control#textchanged) event.                           |

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) MaskedTextBox(label, mask, location, size, onTextChanged)

Initializes a new instance of the [MaskedTextBox](https://docs.wisej.com/api/wisej.web/editors/maskedtextbox) class with specific initial settings.

| Name              | Type                                                                                | Description                                                                                                            |
| ----------------- | ----------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- |
| **label**         | [String](https://docs.microsoft.com/dotnet/api/system.string)                       | The initial text to display in the [MaskedTextBox](https://docs.wisej.com/api/wisej.web/editors/maskedtextbox) label.  |
| **mask**          | [String](https://docs.microsoft.com/dotnet/api/system.string)                       | The initial [Mask](#mask) value.                                                                                       |
| **location**      | [Point](https://docs.microsoft.com/dotnet/api/system.drawing.point)                 | The location of the [MaskedTextBox](https://docs.wisej.com/api/wisej.web/editors/maskedtextbox) on its parent control. |
| **size**          | [Size](https://docs.microsoft.com/dotnet/api/system.drawing.size)                   | The size of the [MaskedTextBox](https://docs.wisej.com/api/wisej.web/editors/maskedtextbox).                           |
| **onTextChanged** | [Action\<Object, EventArgs>](https://docs.microsoft.com/dotnet/api/system.action-2) | Handler for the [TextChanged](https://docs.wisej.com/api/general/control#textchanged) event.                           |

## Properties

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) CharacterCasing

[CharacterCasing](https://docs.wisej.com/api/wisej.web/editors/wisej.web.charactercasing): Returns or sets whether the [MaskedTextBox](https://docs.wisej.com/api/wisej.web/editors/maskedtextbox) control modifies the case of characters as they are typed. (Default: `Normal`)

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) Culture

[CultureInfo](https://docs.microsoft.com/dotnet/api/system.globalization.cultureinfo): Returns or sets the culture information associated with the masked text box.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) Filter

[String](https://docs.microsoft.com/dotnet/api/system.string): Returns or sets a JavaScript regular expression that limits the characters that the user can type. (Default: `null`)

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) HidePromptOnLeave

[Boolean](https://docs.microsoft.com/dotnet/api/system.boolean): Returns or sets whether the prompt characters in the input mask are hidden when the masked text box loses focus. (Default: `False`)

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) InputType

[InputType](https://docs.wisej.com/api/wisej.web/editors/wisej.web.inputtype): Specifies the type, min, max and step properties to associate to the \<input> element.

The default value is an InputType with Type=Text, Mode=Text.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) Mask

[String](https://docs.microsoft.com/dotnet/api/system.string): Returns or sets the input mask. (Default: `""`)

The [Mask](#mask) is a string that defines the masking characters and the literals to display and process during user input and when reading the [Text](#text) property. Server side masking is processed by an instance of the [MaskedTextProvider](https://docs.microsoft.com/dotnet/api/system.componentmodel.maskedtextprovider) class exposed by the [MaskedTextProvider](#maskedtextprovider) property. On the client side, the mask processing is performed by the "wisej.utils.MaskProvider.js" class while the user edits the input field.

| Masking Character | Description                                                                                                                                                                                   |
| ----------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| 0                 | Digit, required. This element will accept any single digit between 0 and 9.                                                                                                                   |
| 9                 | Digit or space, optional.                                                                                                                                                                     |
| #                 | Digit or space, optional. If this position is blank in the mask, it will be rendered as a space in the Text property. Plus (+) and minus (-) signs are allowed.                               |
| L                 | Letter, required. Restricts input to the ASCII letters a-z and A-Z. This mask element is equivalent to \[a-zA-Z] in regular expressions.                                                      |
| ?                 | Letter, optional. Restricts input to the ASCII letters a-z and A-Z. This mask element is equivalent to \[a-zA-Z]? in regular expressions.                                                     |
| &                 | Character, required. This element behaves like the "L" element.                                                                                                                               |
| C                 | Character, optional. Any non-control character. This element behaves like the "?" element.                                                                                                    |
| A                 | Alphanumeric, required. The only characters it will accept are the ASCII letters a-z and A-Z. This mask element behaves like the "a" element.                                                 |
| a                 | Alphanumeric, optional. The only characters it will accept are the ASCII letters a-z and A-Z. This mask element behaves like the "A" element.                                                 |
| .                 | Decimal placeholder. The actual display character used will be the decimal symbol appropriate to the format provider, as determined by the control's FormatProvider property.                 |
| ,                 | Thousands placeholder. The actual display character used will be the thousands placeholder appropriate to the format provider, as determined by the control's FormatProvider property.        |
| :                 | Time separator. The actual display character used will be the time symbol appropriate to the format provider, as determined by the control's FormatProvider property.                         |
| /                 | Date separator. The actual display character used will be the date symbol appropriate to the format provider, as determined by the control's FormatProvider property.                         |
| $                 | Currency symbol. The actual character displayed will be the currency symbol appropriate to the format provider, as determined by the control's FormatProvider property.                       |
| <                 | Shift down. Converts all characters that follow to lowercase.                                                                                                                                 |
| >                 | Shift up. Converts all characters that follow to uppercase.                                                                                                                                   |
|                   |                                                                                                                                                                                               |
| \\                | Escape. Escapes a mask character, turning it into a literal. "\\" is the escape sequence for a backslash.                                                                                     |
| Others            | Literals. All non-mask elements will appear as themselves within MaskedTextBox. Literals always occupy a static position in the mask at run time, and cannot be moved or deleted by the user. |

If you change the [Mask](#mask) when the control already contains a value, it will apply the new mask to the existing text. The decimal (.), thousand (,), time (:), date (/), and currency ($) symbols default to displaying those symbols as defined by the application's culture. You can force a specific [MaskedTextBox](https://docs.wisej.com/api/wisej.web/editors/maskedtextbox) to display symbols for another culture by using the [Culture](#culture) property. Otherwise you can set the application-wide culture by setting the [CurrentCulture](https://docs.wisej.com/api/general/application#currentculture) property.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) MaskedTextProvider

[MaskedTextProvider](https://docs.microsoft.com/dotnet/api/system.componentmodel.maskedtextprovider): Returns the mask provider associated with this instance of the masked text box control.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) PasswordChar

[Char](https://docs.microsoft.com/dotnet/api/system.char): Returns or sets the character used to mask characters of a password in a single-line [MaskedTextBox](https://docs.wisej.com/api/wisej.web/editors/maskedtextbox) control. (Default: `"\0"`)

This property only enables/disables the password mode for the textbox. It doesn't change the password masking character used by the browser.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) PromptChar

[Char](https://docs.microsoft.com/dotnet/api/system.char): Returns or sets the character used to represent the absence of user input in the [MaskedTextBox](https://docs.wisej.com/api/wisej.web/editors/maskedtextbox) control. (Default: `_`)

**Throws:**

* [ArgumentException](https://docs.microsoft.com/dotnet/api/system.argumentexception) The character specified when setting this property is not a valid prompt character.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) RejectInputOnFirstFailure

[Boolean](https://docs.microsoft.com/dotnet/api/system.boolean): Returns or sets whether the parsing of input text should stop after the first invalid character is reached. (Default: `False`)

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) SpellCheck

[Boolean](https://docs.microsoft.com/dotnet/api/system.boolean): Returns or sets whether the text in the [MaskedTextBox](https://docs.wisej.com/api/wisej.web/editors/maskedtextbox) is spell checked by the browser. (Default: `False`)

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) Text

[String](https://docs.microsoft.com/dotnet/api/system.string): Returns or sets the current text in the text box. (Default: `""`)

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) TextAlign

[HorizontalAlignment](https://docs.wisej.com/api/wisej.web/enumerations/wisej.web.horizontalalignment): Returns or sets how text is aligned in a [TextBox](https://docs.wisej.com/api/wisej.web/editors/wisej.web.textbox) control. (Default: `Left`)

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) TextLength

[Int32](https://docs.microsoft.com/dotnet/api/system.int32): Returns the length of text in the control.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) TextMaskFormat

[MaskFormat](https://docs.wisej.com/api/wisej.web/enumerations/wisej.web.maskformat): Returns or sets a value that determines whether literals and prompt characters are included in the formatted string. (Default: `IncludeLiterals`)

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) ValidatingType

[Type](https://docs.microsoft.com/dotnet/api/system.type): Returns or sets the data type used to verify the data input by the user. (Default: `null`)

## Methods

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-9bf7fa01e02f4da0f9ef90d3b049ae43e664919e%2Fprotected.png?alt=media) MaskText(text)

Applies the mask to the text.

| Parameter | Type                                                          | Description   |
| --------- | ------------------------------------------------------------- | ------------- |
| **text**  | [String](https://docs.microsoft.com/dotnet/api/system.string) | Text to mask. |

**Returns:** [String](https://docs.microsoft.com/dotnet/api/system.string). Masked text.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-9bf7fa01e02f4da0f9ef90d3b049ae43e664919e%2Fprotected.png?alt=media) OnCultureChanged(e)

Fires the [CultureChanged](#culturechanged) event.

| Parameter | Type                                                                | Description                                                                                      |
| --------- | ------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------ |
| **e**     | [EventArgs](https://docs.microsoft.com/dotnet/api/system.eventargs) | An [EventArgs](https://docs.microsoft.com/dotnet/api/system.eventargs) that contains event data. |

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-9bf7fa01e02f4da0f9ef90d3b049ae43e664919e%2Fprotected.png?alt=media) OnMaskChanged(e)

Fires the [MaskChanged](#maskchanged) event.

| Parameter | Type                                                                | Description                                                                                      |
| --------- | ------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------ |
| **e**     | [EventArgs](https://docs.microsoft.com/dotnet/api/system.eventargs) | An [EventArgs](https://docs.microsoft.com/dotnet/api/system.eventargs) that contains event data. |

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-9bf7fa01e02f4da0f9ef90d3b049ae43e664919e%2Fprotected.png?alt=media) OnTextAlignChanged(e)

Fires the [TextAlignChanged](https://docs.wisej.com/api/wisej.web/wisej.web.textbox#textalignchanged) event.

| Parameter | Type                                                                | Description                                                                                         |
| --------- | ------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- |
| **e**     | [EventArgs](https://docs.microsoft.com/dotnet/api/system.eventargs) | A [EventArgs](https://docs.microsoft.com/dotnet/api/system.eventargs) that contains the event data. |

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-9bf7fa01e02f4da0f9ef90d3b049ae43e664919e%2Fprotected.png?alt=media) OnTypeValidationCompleted(e)

Fires the [TypeValidationCompleted](#typevalidationcompleted) event.

| Parameter | Type                                                                                                                    | Description                                                                                                                                              |
| --------- | ----------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **e**     | [TypeValidationEventArgs](https://docs.wisej.com/api/wisej.web/editors/maskedtextbox/wisej.web.typevalidationeventargs) | An [TypeValidationEventArgs](https://docs.wisej.com/api/wisej.web/editors/maskedtextbox/wisej.web.typevalidationeventargs) that contains the event data. |

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-9bf7fa01e02f4da0f9ef90d3b049ae43e664919e%2Fprotected.png?alt=media) OnValidating(e)

Fires the [Validating](https://docs.wisej.com/api/general/control#validating) event.

| Parameter | Type                                                                                           | Description                                                                                                                |
| --------- | ---------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- |
| **e**     | [CancelEventArgs](https://docs.microsoft.com/dotnet/api/system.componentmodel.canceleventargs) | A [CancelEventArgs](https://docs.microsoft.com/dotnet/api/system.componentmodel.canceleventargs) that contains event data. |

**Throws:**

* [Exception](https://docs.microsoft.com/dotnet/api/system.exception) A critical exception occurred during the parsing of the input string.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-9bf7fa01e02f4da0f9ef90d3b049ae43e664919e%2Fprotected.png?alt=media) OnWebRender(config)

Renders the client component.

| Parameter  | Type                                                          | Description                   |
| ---------- | ------------------------------------------------------------- | ----------------------------- |
| **config** | [Object](https://docs.microsoft.com/dotnet/api/system.object) | Dynamic configuration object. |

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-9bf7fa01e02f4da0f9ef90d3b049ae43e664919e%2Fprotected.png?alt=media) UnmaskText(text)

Removes the mask from the text.

| Parameter | Type                                                          | Description     |
| --------- | ------------------------------------------------------------- | --------------- |
| **text**  | [String](https://docs.microsoft.com/dotnet/api/system.string) | Text to unmask. |

**Returns:** [String](https://docs.microsoft.com/dotnet/api/system.string). Unmasked text.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) ValidateText()

Converts the user input string to an instance of the validating type.

**Returns:** [Object](https://docs.microsoft.com/dotnet/api/system.object). If successful, an [Object](https://docs.microsoft.com/dotnet/api/system.object) of the type specified by the [ValidatingType](#validatingtype) property; otherwise, null to indicate conversion failure.

**Throws:**

* [Exception](https://docs.microsoft.com/dotnet/api/system.exception) A critical exception occurred during the parsing of the input string.

## Events

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) CultureChanged

[EventHandler](https://docs.microsoft.com/dotnet/api/system.eventhandler) Fired when the value of the [Culture](#culture) property has changed.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) MaskChanged

[EventHandler](https://docs.microsoft.com/dotnet/api/system.eventhandler) Fired when the value of the [Mask](#mask) property has changed.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) TextAlignChanged

[EventHandler](https://docs.microsoft.com/dotnet/api/system.eventhandler) Fired when the value of the [TextAlign](#textalign) property has changed.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) TypeValidationCompleted

[TypeValidationEventHandler](https://docs.wisej.com/api/wisej.web/editors/maskedtextbox/wisej.web.typevalidationeventhandler) Occurs when [MaskedTextBox](https://docs.wisej.com/api/wisej.web/editors/maskedtextbox) has finished parsing the current value using the [ValidatingType](#validatingtype) property.

## Inherited By

| Name                                                                                                                                                           | Description                                                                                                                                                                                                                                                               |
| -------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [DataGridViewMaskedTextBoxEditingControl](https://docs.wisej.com/api/wisej.web/lists-and-grids/datagridview/wisej.web.datagridviewmaskedtextboxeditingcontrol) | Represents a [MaskedTextBox](https://docs.wisej.com/api/wisej.web/editors/maskedtextbox) control that can be hosted in a [DataGridViewMaskedTextBoxCell](https://docs.wisej.com/api/wisej.web/lists-and-grids/datagridview/wisej.web.datagridviewmaskedtextboxcell) cell. |

## Implements

| Name                                                                                                 | Description                                                                                                                                                                                                                                                       |
| ---------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [IUserData](https://docs.wisej.com/api/wisej.web/interfaces/wisej.web.iuserdata)                     | Provides access to the `UserData` and `Tag` properties associated to the component implementing this interface.                                                                                                                                                   |
| [IBindableComponent](https://docs.wisej.com/api/wisej.web/data-binding/wisej.web.ibindablecomponent) | Bindable components implement this interface.                                                                                                                                                                                                                     |
| [IDropTarget](https://docs.wisej.com/api/wisej.web/interfaces/wisej.web.idroptarget)                 | Controls that support drag & drop operations implement this interface.                                                                                                                                                                                            |
| [ILabel](https://docs.wisej.com/api/wisej.web/interfaces/wisej.web.ilabel)                           | Provides access to the [LabelWrapper](https://docs.wisej.com/api/wisej.web/editors/wisej.web.labelwrapper) associated with the controls that implement this interface.                                                                                            |
| [IReadOnly](https://docs.wisej.com/api/wisej.web/interfaces/wisej.web.ireadonly)                     | Provides access to the [ReadOnly](https://docs.wisej.com/api/interfaces/wisej.web.ireadonly#readonly) property for coontrols that support the read-only mode.                                                                                                     |
| [IModified](https://docs.wisej.com/api/wisej.web/interfaces/wisej.web.imodified)                     | Provides access to the [Modified](https://docs.wisej.com/api/interfaces/wisej.web.imodified#modified) property and [ModifiedChanged](https://docs.wisej.com/api/interfaces/wisej.web.imodified#modifiedchanged) event for controls that implement this interface. |
| [IValidation](https://docs.wisej.com/api/wisej.web/interfaces/wisej.web.ivalidation)                 | Provides access to the validation events and properties property for controls that support validation.                                                                                                                                                            |
| [IWisejComponent](https://docs.wisej.com/api/wisej.core/interfaces/wisej.core.iwisejcomponent)       | All wisej components implement this interface.                                                                                                                                                                                                                    |
| [IWisejControl](https://docs.wisej.com/api/wisej.core/interfaces/wisej.core.iwisejcontrol)           | All wisej controls derived from the [Control](https://docs.wisej.com/api/wisej.web/general/control) class must implement this interface.                                                                                                                          |
| [IWisejSerializable](https://docs.wisej.com/api/wisej.core/interfaces/wisej.core.iwisejserializable) | Allows an object to serialize itself.                                                                                                                                                                                                                             |
