# TelephoneValidationRule

Namespace: **Wisej.Web**

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

* [ValidationRule](/api/wisej.web/extenders/validation/wisej.web.validationrule.md)
  * [TelephoneValidationRule](/api/wisej.web/extenders/validation/wisej.web.telephonevalidationrule.md)

Validates telephone numbers.

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

```csharp
public class TelephoneValidationRule : ValidationRule
```

{% endtab %}

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

```visual-basic
Public Class TelephoneValidationRule
    Inherits ValidationRule
```

{% endtab %}
{% endtabs %}

## Constructors

### ![](/files/hsR4ok3152WyAf8J2C1u) TelephoneValidationRule()

Initializes a new instance of the [TelephoneValidationRule](/api/wisej.web/extenders/validation/wisej.web.telephonevalidationrule.md) class.

## Properties

### ![](/files/hsR4ok3152WyAf8J2C1u) Format

[Boolean](https://docs.microsoft.com/dotnet/api/system.boolean): Returns or sets whether to format the value of the control after validation. (Default: `False`)

### ![](/files/hsR4ok3152WyAf8J2C1u) Mask

[String](https://docs.microsoft.com/dotnet/api/system.string): Returns or sets the character mask used to validate the telephone number. It is based on the [MaskedTextProvider](#maskedtextprovider) implementation. (Default: `""`)

### ![](/files/hsR4ok3152WyAf8J2C1u) MaskedTextProvider

[MaskedTextProvider](https://docs.microsoft.com/dotnet/api/system.componentmodel.maskedtextprovider): Returns the [MaskedTextProvider](#maskedtextprovider) used to validate the control's text.

### ![](/files/hsR4ok3152WyAf8J2C1u) Name

[String](https://docs.microsoft.com/dotnet/api/system.string): Returns or sets the name of the validation rule. (Default: `"Telephone"`)

### ![](/files/hsR4ok3152WyAf8J2C1u) Required

[Boolean](https://docs.microsoft.com/dotnet/api/system.boolean): Returns or sets whether the control can be empty or its required to have a value. (Default: `False`)

## Methods

### ![](/files/hsR4ok3152WyAf8J2C1u) OnValidated(control)

Invoked after the control has been successfully validated.

| Parameter   | Type                                         | Description |
| ----------- | -------------------------------------------- | ----------- |
| **control** | [Control](/api/wisej.web/general/control.md) |             |

### ![](/files/hsR4ok3152WyAf8J2C1u) OnValidating(control)

Validates the *control* using the validation rule.

| Parameter   | Type                                         | Description |
| ----------- | -------------------------------------------- | ----------- |
| **control** | [Control](/api/wisej.web/general/control.md) |             |

**Returns:** [Boolean](https://docs.microsoft.com/dotnet/api/system.boolean). true if the validation is successful; otherwise false.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.wisej.com/api/wisej.web/extenders/validation/wisej.web.telephonevalidationrule.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
