# RequiredValidationRule

Namespace: **Wisej.Web**

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

* [ValidationRule](/api/wisej.web/extenders/validation/wisej.web.validationrule.md)
  * [RequiredValidationRule](/api/wisej.web/extenders/validation/wisej.web.requiredvalidationrule.md)

Validates controls that cannot be left empty.

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

```csharp
public class RequiredValidationRule : ValidationRule
```

{% endtab %}

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

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

{% endtab %}
{% endtabs %}

## Constructors

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

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

## Properties

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

[Nullable\<Int32>](https://docs.microsoft.com/dotnet/api/system.nullable-1): Returns or sets the required minimum number of characters. (Default: `null`)

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

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

### ![](/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: `True`)

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

[Boolean](https://docs.microsoft.com/dotnet/api/system.boolean): Returns or sets whether empty controls with spaces are considered empty and fail validation. (Default: `True`)

## Methods

### ![](/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.requiredvalidationrule.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.
