Skip to content

DOCINFRA-2341_merged_using_automation #6106

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 43 commits into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
7663004
826671: Need to add styles and appearance topic in the Blazor File Ma…
PrasanthMadhaiyan May 16, 2025
b1eb64c
957745: Content checking for below md
NithyaSivaprakasam May 20, 2025
4c7e192
959420: Persisting Data in Server
NithyaSivaprakasam May 21, 2025
c67367c
Update persisting-data-in-server.md
NithyaSivaprakasam May 21, 2025
970d6d4
Update persisting-data-in-server.md
NithyaSivaprakasam May 21, 2025
2b0c8a1
826671: Need to add styles and appearance topic in the Blazor File Ma…
PrasanthMadhaiyan May 22, 2025
066121d
Merge branch 'hotfix/hotfix-v29.2.4' into 957745-content-check-new
NithyaSivaprakasam Jun 4, 2025
c7ef93d
957745: Corrections
NithyaSivaprakasam Jun 4, 2025
610cbeb
Merge branch '957745-content-check-new' of https://github.com/syncfus…
NithyaSivaprakasam Jun 4, 2025
426ee1d
853075: Updated docs related to showcase and single nuget
Athiswaran-SF3980 Jun 5, 2025
7209680
Merge branch 'hotfix/hotfix-v29.2.4' into 957745-content-check-new
NithyaSivaprakasam Jun 9, 2025
da45af5
Update in-line-editing.md
NithyaSivaprakasam Jun 10, 2025
cdc83d0
Update in-line-editing.md
NithyaSivaprakasam Jun 10, 2025
b78418b
Merge branch 'hotfix/hotfix-v29.2.4' into 957745-content-check-new
NithyaSivaprakasam Jun 10, 2025
f421a89
Merge pull request #6091 from syncfusion-content/853075-update-docs-HF
kmuthukumarmkm Jun 11, 2025
45fe33d
documentation(962721):Resolved issue
JamunaSundaramSF3699 Jun 12, 2025
7ab0b16
937492: Remove net6 and net7 reference in UG
Athiswaran-SF3980 Jun 12, 2025
6217c2e
documentation(962721):Resolved issue
JamunaSundaramSF3699 Jun 12, 2025
81bd93d
documentation(962721):Resolved issue
JamunaSundaramSF3699 Jun 12, 2025
cff8497
documentation(962721):Resolved issue
JamunaSundaramSF3699 Jun 12, 2025
4e7831c
Merge pull request #6107 from syncfusion-content/962721-resolve-issue
farveensulthana Jun 12, 2025
a839cfb
Update blazor-toc.html
NithyaSivaprakasam Jun 12, 2025
b0819d4
Merge pull request #6112 from syncfusion-content/NithyaSivaprakasam-p…
farveensulthana Jun 12, 2025
692e44b
Merge pull request #6111 from syncfusion-content/937492-updateHF
kmuthukumarmkm Jun 12, 2025
e3e15aa
Update persisting-data-in-server.md
NithyaSivaprakasam Jun 12, 2025
707aaad
Update persisting-data-in-server.md
NithyaSivaprakasam Jun 12, 2025
b3b85dd
Merge pull request #6029 from syncfusion-content/959420-persisting-in…
farveensulthana Jun 13, 2025
897199b
963203: Updating the UI kit overview documentation content
Sridhar-Karunakaran Jun 13, 2025
f5464aa
Merge branch 'hotfix/hotfix-v29.2.4' into Blaz-963203
Sridhar-Karunakaran Jun 13, 2025
f877cf5
documentation(950115):New topic
JamunaSundaramSF3699 Jun 13, 2025
780c14f
documentation(950115):New topic
JamunaSundaramSF3699 Jun 13, 2025
af54cca
documentation(950115):New topic
JamunaSundaramSF3699 Jun 13, 2025
7aaa82c
documentation(950115):New topic
JamunaSundaramSF3699 Jun 13, 2025
7ef68b0
documentation(950115):New topic
JamunaSundaramSF3699 Jun 13, 2025
67ed541
Merge pull request #6126 from syncfusion-content/Blaz-963203
harivenkateshe Jun 13, 2025
8227bf8
Merge branch 'hotfix/hotfix-v29.2.4' into 957745-content-check-new
NithyaSivaprakasam Jun 13, 2025
af94cdb
Merge pull request #6021 from syncfusion-content/957745-content-check…
farveensulthana Jun 13, 2025
84afb25
documentation(950115):updated
JamunaSundaramSF3699 Jun 13, 2025
2083a58
826671: Need to add styles and appearance topic in the Blazor File Ma…
PrasanthMadhaiyan Jun 13, 2025
78c9813
Merge branch 'hotfix/hotfix-v29.2.4' into ES-826671-fm-hf
PrasanthMadhaiyan Jun 13, 2025
4f8ee8f
documentation(950115):updated
JamunaSundaramSF3699 Jun 13, 2025
9d4763f
Merge pull request #6127 from syncfusion-content/950115-sample
farveensulthana Jun 13, 2025
7e3d1db
Merge pull request #5990 from syncfusion-content/ES-826671-fm-hf
keerthanaRajendran Jun 13, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 19 additions & 10 deletions blazor-toc.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion blazor/common/showcase-samples.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Syncfusion<sup style="font-size:70%">&reg;</sup> has a collection of sample appl
| Organizational Chart | An organizational chart is a diagram that visually conveys a company's internal structure by detailing the roles, responsibilities, and relationships between individuals within an entity. | [Server](https://blazor.syncfusion.com/showcase/organization-chart/)/[WASM](https://blazor.syncfusion.com/showcase/wasm/organization-chart/) | [GitHub code](https://github.com/syncfusion/blazor-showcase-organizational-chart) |
| Document Explorer | Manages the file system that allows users to access, edit, and sort files or folders and open Word, PowerPoint, and PDF documents. | [Server](https://blazor.syncfusion.com/showcase/documentexplorer/) | [GitHub code](https://github.com/syncfusion/blazor-showcase-document-explorer) |
| Sprint Management | Sprint management involves managing the sprint board of an organization. It allows teams to track tasks, allocate work, and monitor progress during a sprint. | [Server](https://blazor.syncfusion.com/showcase/sprint-management/) | [GitHub code](https://github.com/syncfusion/blazor-showcase-sprint-management) |
| Hotel Booking | Hotel Booking App empowers hotel owners by streamlining room bookings, management, and offering real-time insights into occupancy, including current bookings and available rooms per floor. | [Server](https://blazor.syncfusion.com/showcase/hotel-booking) | [GitHub code](https://github.com/syncfusion/blazor-showcase-hotel-booking) |
| Stay Reservation |Stay Reservation simplifies room bookings, streamlines management for hotel owners, and provides real-time insights into occupancy, including active reservations and available rooms by floor. | [Server](https://blazor.syncfusion.com/showcase/stay-reservation) | [GitHub code](https://github.com/syncfusion/blazor-showcase-stay-reservation)|
| Stock Market Dashboard | StockMarket Dashboard Showcase app is a comprehensive tool that provides real-time data, analytics, and insights for investors, displaying key financial metrics and market trends in an intuitive interface. | [Server](https://blazor.syncfusion.com/showcase/stockmarket-dashboard/) | [GitHub code](https://github.com/syncfusion/blazor-showcase-stockmarket-dashboard) |
| Fitness Tracker | Track and visualize data of your daily activities, diet and fasting to track fitness of daily statistics. | [Server](https://blazor.syncfusion.com/showcase/fitness-tracker/) | [GitHub code](https://github.com/syncfusion/blazor-showcase-fitness-tracker) |
| Loan Calculator | Calculate loan payments, interest rates, and amortization schedules. When you are planning for a personal loan or analyzing business financing options, this provides accurate results and helps you make informed financial decisions. | [WASM](https://blazor.syncfusion.com/showcase/wasm/loan-calculator/) | [GitHub code](https://github.com/syncfusion/blazor-showcase-loan-calculator) |
Expand Down
111 changes: 62 additions & 49 deletions blazor/datagrid/batch-editing.md

Large diffs are not rendered by default.

58 changes: 29 additions & 29 deletions blazor/datagrid/column-validation.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
---
layout: post
title: Column Validation in Blazor DataGrid Component | Syncfusion
description: Checkout and learn here all about Column Validation in Syncfusion Blazor DataGrid component and much more details.
title: Column Validation in Blazor DataGrid | Syncfusion
description: Checkout and learn here all about Column Validation in Syncfusion Blazor DataGrid and much more details.
platform: Blazor
control: DataGrid
documentation: ug
---

# Validation in Blazor DataGrid component
# Validation in Blazor DataGrid

Validation is a crucial aspect of data integrity in any application. The Blazor Grid component in Syncfusion provides built-in support for easy and effective data validation. This feature ensures that the data entered or modified adheres to predefined rules, preventing errors and guaranteeing the accuracy of the displayed information.
Validation is a crucial aspect of data integrity in any application. The Syncfusion Blazor DataGrid provides built-in support for easy and effective data validation. This feature ensures that the data entered or modified adheres to predefined rules, preventing errors and guaranteeing the accuracy of the displayed information.

## Column validation

Column validation allows you to validate the edited or added row data before saving it. This feature is particularly useful when you need to enforce specific rules or constraints on individual columns to ensure data integrity. By applying validation rules to columns, you can display error messages for invalid fields and prevent the saving of erroneous data. This feature leverages the **Form Validator** library to perform the validation. You can define validation rules using the [GridColumn.ValidationRules](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Grids.GridColumn.html#Syncfusion_Blazor_Grids_GridColumn_ValidationRules) property to specify the criteria for validating column values.
Column validation allows you to validate edited or newly added row data before saving it. This feature is particularly useful when you need to enforce specific rules or constraints on individual columns to ensure data integrity. By applying validation rules to columns, you can display error messages for invalid fields and prevent the saving of erroneous data. This feature leverages the **Form Validator** library to perform validation. You can define validation rules using the [GridColumn.ValidationRules](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Grids.GridColumn.html#Syncfusion_Blazor_Grids_GridColumn_ValidationRules) property to specify the criteria for validating column values.

> Validation in datagrid works based on the Microsoft Blazor EditForm behavior. So once the validation message is shown then it will be again validated only during the form submit or when you focus out from that particular field. Refer the [Microsoft Validation](https://learn.microsoft.com/en-us/aspnet/core/blazor/forms/validation?view=aspnetcore-5.0#data-annotations-validator-component-and-custom-validation) for further reference.
> Validation in Grid works based on the Microsoft Blazor EditForm behavior. Once a validation message is shown, it will be validated again only during form submission or when you focus out from that particular field. Refer to the [Microsoft Validation](https://learn.microsoft.com/en-us/aspnet/core/blazor/forms/validation?view=aspnetcore-5.0#data-annotations-validator-component-and-custom-validation) documentation for further reference.

The following code example demonstrates how to define a validation rule for grid column:
The following code example demonstrates how to define a validation rule for a Grid column:

{% tabs %}
{% highlight razor tabtitle="Index.razor" %}
Expand Down Expand Up @@ -88,21 +88,21 @@ public class OrderDetails

## Data annotation

Data Annotation validation attributes are used to validate the fields in the DataGrid. The validation attributes that are supported in the DataGrid are listed below.
Data annotation validation attributes are used to validate fields in the DataGrid. The following validation attributes are supported in the Grid:

| Attribute Name | Functionality |
|-------|---------|
| Validations are,<br><br>1. RequiredAttribute<br>2. StringLengthAttribute<br>3. RangeAttribute<br>4. RegularExpressionAttribute<br>5. MinLengthAttribute<br>6. MaxLengthAttribute<br>7. EmailAddressAttribute<br>8. CompareAttribute<br>9. DataTypeAttribute<br>10. DataType.Custom<br>11. DataType.Date<br>12. DataType.DateTime<br>13. DataType.EmailAddress<br>14. DataType.ImageUrl<br>15. DataType.Url | The data annotation validation attributes are used as `validation rules` in the DataGrid CRUD operations |
|---------------|--------------|
| 1. RequiredAttribute<br>2. StringLengthAttribute<br>3. RangeAttribute<br>4. RegularExpressionAttribute<br>5. MinLengthAttribute<br>6. MaxLengthAttribute<br>7. EmailAddressAttribute<br>8. CompareAttribute<br>9. DataTypeAttribute<br>10. DataType.Custom<br>11. DataType.Date<br>12. DataType.DateTime<br>13. DataType.EmailAddress<br>14. DataType.ImageUrl<br>15. DataType.Url | These data annotation validation attributes are used as `validation rules` in DataGrid CRUD operations. |

More information on the data annotation can be found in this [documentation](https://blazor.syncfusion.com/documentation/datagrid/data-annotation) section.
For more information on data annotation, refer to this [documentation](https://blazor.syncfusion.com/documentation/datagrid/data-annotation) section.

## Custom validation

Custom Validation allows the users to customize the validations manually according to the individuals criteria.
Custom validation allows users to define their own validation logic based on specific requirements.

Custom Validation can be used by overriding the IsValid method inside the class inherits the Validation Attribute. All the validations are done inside the IsValid method.
To implement custom validation, create a class that inherits from the `ValidationAttribute` class and override the `IsValid` method. All custom validation logic should be placed inside the `IsValid` method.

The following sample code demonstrates custom validations implemented in the fields **EmployeeID** and **Freight**.
The following sample code demonstrates how to implement custom validation for the **EmployeeID** and **Freight** fields.

{% tabs %}
{% highlight razor tabtitle="Index.razor" %}
Expand Down Expand Up @@ -223,9 +223,9 @@ public class CustomValidationFreight : ValidationAttribute

### Validate complex column using data annotation attribute

You can perform validation for complex data binding columns using the [ValidateComplexType](https://learn.microsoft.com/en-us/aspnet/core/blazor/forms/validation?view=aspnetcore-5.0#data-annotations-validator-component-and-custom-validation) attribute of data annotation.
You can validate complex data binding columns by using the [ValidateComplexType](https://learn.microsoft.com/en-us/aspnet/core/blazor/forms/validation?view=aspnetcore-5.0#data-annotations-validator-component-and-custom-validation) attribute from data annotations.

In the following sample, you must use the `ValidateComplexType` attribute for the EmployeeName class and display custom message in the "First Name" column using the `RequiredAttribute` of data annotation.
In the following sample, the `ValidateComplexType` attribute is applied to the `EmployeeName` class to enable validation of its properties. A custom validation message is displayed in the "First Name" column by using the `RequiredAttribute` with a custom error message.

{% tabs %}
{% highlight razor tabtitle="Index.razor" %}
Expand Down Expand Up @@ -303,16 +303,16 @@ public class EmployeeInfo

## Custom validator component

Apart from using default validation and custom validation, there are cases where you might want to use your validator component to validate the grid edit form. Such cases can be achieved using the **Validator** property of the **GridEditSettings** component which accepts a validation component and inject it inside the **EditForm** of the grid. Inside the **Validator**, you can access the data using the implicit named parameter context which is of type [ValidatorTemplateContext](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Grids.ValidatorTemplateContext.html).
In addition to using the default and custom validation options, there may be scenarios where you want to implement your own validator component to validate the Grid edit form. This can be accomplished by using the **Validator** property of the **GridEditSettings** component, which accepts a validation component and injects it inside the **EditForm** of the Grid. Within the **Validator**, you can access the data using the implicit parameter `context`, which is of type [ValidatorTemplateContext](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Grids.ValidatorTemplateContext.html).

For creating a form validator component you can refer [here](https://learn.microsoft.com/en-us/aspnet/core/blazor/forms-and-input-components?view=aspnetcore-5.0#validator-components).
For guidance on creating a form validator component, refer to the [official documentation](https://learn.microsoft.com/en-us/aspnet/core/blazor/forms-and-input-components?view=aspnetcore-5.0#validator-components).

In the below code example, the following things have been done.
In the following code example:

* Created a form validator component named `MyCustomValidator` which accepts [ValidatorTemplateContext](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Grids.ValidatorTemplateContext.html) value as parameter.
* Used the `MyCustomValidator` component inside the **Validator** property.
* This validator component will check whether Freight value is in between 0 to 100.
* Displayed the validation error messages using **ValidationMessage** component.
* A form validator component named `MyCustomValidator` is created, which accepts a [ValidatorTemplateContext](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Grids.ValidatorTemplateContext.html) value as a parameter.
* The `MyCustomValidator` component is used inside the **Validator** property.
* This validator component checks whether the Freight value is between 0 and 100.
* Validation error messages are displayed using the **ValidationMessage** component.

```csharp
[MyCustomValidator.cs]
Expand Down Expand Up @@ -400,9 +400,9 @@ public class MyCustomValidator : ComponentBase

## Display validation message using in-built tooltip

In the above code example, you can see that **ValidationMessage** component is used, this might be not suitable when using Inline editing or batch editing. In such cases, you can use the in-built validation tooltip to show those error messages by using `ValidatorTemplateContext.ShowValidationMessage(fieldName, IsValid, Message)` method.
In the above code example, the **ValidationMessage** component is used. However, this approach may not be suitable when using Inline editing or Batch editing modes. In such cases, you can use the built-in validation tooltip to display error messages by calling the `ValidatorTemplateContext.ShowValidationMessage(fieldName, isValid, message)` method.

Now the HandleValidation method of the MyCustomValidator component would be changed like below.
The `HandleValidation` method of the `MyCustomValidator` component can be updated as shown below.

```c#
protected void HandleValidation(FieldIdentifier identifier)
Expand Down Expand Up @@ -433,7 +433,7 @@ protected void HandleValidation(FieldIdentifier identifier)

## Disable in-built validator component

**Validator** property can also be used to disable the in-built validator component used by the grid. For instance, by default, the grid uses two validator components, **DataAnnotationValidator** and an internal [ValidationRules](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Grids.GridColumn.html#Syncfusion_Blazor_Grids_GridColumn_ValidationRules) property handling validator, for handling edit form validation. If you are willing to use only the **DataAnnotationValidator** component, then it could be simply achieved by using the below code.
The **Validator** property can also be used to disable the built-in validator component used by the Syncfusion Blazor DataGrid. By default, the Grid uses two validator components: **DataAnnotationsValidator** and an internal validator that handles the [ValidationRules](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Grids.GridColumn.html#Syncfusion_Blazor_Grids_GridColumn_ValidationRules) property for edit form validation. If you want to use only the **DataAnnotationsValidator** component, you can achieve this by using the following code.

```c#
<SfGrid TValue="OrdersDetails" DataSource="GridData" Toolbar="@(new List<string>() { "Add", "Edit", "Update", "Cancel" })">
Expand Down Expand Up @@ -463,11 +463,11 @@ protected void HandleValidation(FieldIdentifier identifier)

## Display validation message in dialog template

Use the form validation to display a validation message for a column that is not defined in the grid.
Use form validation to display a validation message for a field that is not defined as a column in the Syncfusion Blazor DataGrid.

Use the **Validator** property to display a validation message for one of the fields in the dialog template that is not defined in the Grid column. The validation message for the **ShipAddress** is displayed in the dialog template in the following example. In the grid column, the **ShipAddress** field is not defined.
You can use the **Validator** property to show a validation message for a field in the dialog template, even if that field is not present in the Grid columns. In the following example, the validation message for **ShipAddress** is displayed in the dialog template, even though the **ShipAddress** field is not defined as a Grid column.

> The validation message for fields that are not defined in the grid column will be shown as the validation summary (top of the dialog edit form) in the dialog edit form.
> Validation messages for fields not defined in the Grid columns will appear as a validation summary at the top of the dialog edit form.

{% tabs %}
{% highlight razor tabtitle="Index.razor" %}
Expand Down
Loading