Skip to content

Commit 2ecff8e

Browse files
committed
Documentation - Need to correction the content of the ASP.NET topics
1 parent 02ea96e commit 2ecff8e

File tree

4 files changed

+52
-52
lines changed

4 files changed

+52
-52
lines changed

ej2-asp-core-mvc/grid/EJ2_ASP.MVC/editing/edit.md

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -192,31 +192,6 @@ In the following code example, the Employee Name is a foreign key column. When e
192192
| -------------- | ------------- |
193193
| ![Foreign key column edit](../images/editing/on-foreign-key-column-editing.png) | ![After foreign key column edit](../images/editing/after-foreign-key-column-editing.png) |
194194

195-
## Prevent adding duplicate rows in Syncfusion ASP.NET MVC Grid with custom validation
196-
197-
The Syncfusion ASP.NET MVC Grid allows you to enforce constraints to prevent duplicate rows by customizing the validation logic within the Grid setup. This ensures data integrity by restricting duplicate entries in the **OrderID** column.
198-
199-
To prevent adding duplicate rows in the Grid, follow these steps:
200-
201-
1. Implement Custom Validation: Define the `orderIdCustomValidation` function to check whether the entered **OrderID** already exists in the [DataSource](https://help.syncfusion.com/cr/aspnetmvc-js2/Syncfusion.EJ2.Grids.Grid.html#Syncfusion_EJ2_Grids_Grid_DataSource). This allows editing an existing row without triggering a duplicate error.
202-
203-
2. Add Dynamic Validation Rules: Create the `orderIDRules` object to enforce unique **OrderID** values. Dynamically add this rule to the form during the **save** action.
204-
205-
3. Handle Validation in the [ActionBegin](https://help.syncfusion.com/cr/aspnetmvc-js2/syncfusion.ej2.grids.grid.html#Syncfusion_EJ2_Grids_Grid_ActionBegin) event: In the `ActionBegin` event, check if the **requestType** is **save**. Apply the validation rule before saving and cancel the action `args.cancel = true` if the validation fails.
206-
207-
For server-side validation to prevent adding duplicate rows, you can refer to the detailed guidance provided in our [knowledge base](https://support.syncfusion.com/kb/article/11608/how-to-do-server-side-validation-for-grid-in-asp-net-mvc-application). If you want to display the Grid's validation tooltip instead of the alert used in our knowledge base, you can call the `grid.editModule.formObj.validate()` method in the `Ajax/Fetch` success function to display the Grid's tooltip validation for the server side.
208-
209-
{% tabs %}
210-
{% highlight razor tabtitle="CSHTML" %}
211-
{% include code-snippet/grid/edit/prevent-add-duplicate/razor %}
212-
{% endhighlight %}
213-
{% highlight c# tabtitle="Edit-temp.cs" %}
214-
{% include code-snippet/grid/edit/prevent-add-duplicate/customvalidation.cs %}
215-
{% endhighlight %}
216-
{% endtabs %}
217-
218-
![Prevent Duplicate row](../images/editing/prevent-duplicate-row.png)
219-
220195
## How to perform CRUD action externally
221196

222197
Performing CRUD (Create, Read, Update, Delete) actions externally in the Syncfusion<sup style="font-size:70%">&reg;</sup> Grid allows you to manipulate grid data outside the grid itself. This can be useful in scenarios where you want to manage data operations programmatically.

ej2-asp-core-mvc/grid/EJ2_ASP.MVC/editing/validation.md

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,4 +333,29 @@ namespace UrlAdaptor.Controllers
333333
{% endhighlight %}
334334
{% endtabs %}
335335

336-
![Show custom error message](../images/editing/custom-message.png)
336+
![Show custom error message](../images/editing/custom-message.png)
337+
338+
## Prevent adding duplicate rows with custom validation
339+
340+
The Syncfusion ASP.NET MVC Grid allows you to enforce constraints to prevent duplicate rows by customizing the validation logic within the Grid setup. This ensures data integrity by restricting duplicate entries in the **OrderID** column.
341+
342+
To prevent adding duplicate rows in the Grid, follow these steps:
343+
344+
1. Implement Custom Validation: Define the `orderIdCustomValidation` function to check whether the entered **OrderID** already exists in the [DataSource](https://help.syncfusion.com/cr/aspnetmvc-js2/Syncfusion.EJ2.Grids.Grid.html#Syncfusion_EJ2_Grids_Grid_DataSource). This allows editing an existing row without triggering a duplicate error.
345+
346+
2. Add Dynamic Validation Rules: Create the `orderIDRules` object to enforce unique **OrderID** values. Dynamically add this rule to the form during the **save** action.
347+
348+
3. Handle Validation in the [ActionBegin](https://help.syncfusion.com/cr/aspnetmvc-js2/syncfusion.ej2.grids.grid.html#Syncfusion_EJ2_Grids_Grid_ActionBegin) event: In the `ActionBegin` event, check if the **requestType** is **save**. Apply the validation rule before saving and cancel the action `args.cancel = true` if the validation fails.
349+
350+
For server-side validation to prevent adding duplicate rows, you can refer to the detailed guidance provided in our [knowledge base](https://support.syncfusion.com/kb/article/11608/how-to-do-server-side-validation-for-grid-in-asp-net-mvc-application). If you want to display the Grid's validation tooltip instead of the alert used in our knowledge base, you can call the `grid.editModule.formObj.validate()` method in the `Ajax/Fetch` success function to display the Grid's tooltip validation for the server side.
351+
352+
{% tabs %}
353+
{% highlight razor tabtitle="CSHTML" %}
354+
{% include code-snippet/grid/edit/prevent-add-duplicate/razor %}
355+
{% endhighlight %}
356+
{% highlight c# tabtitle="Edit-temp.cs" %}
357+
{% include code-snippet/grid/edit/prevent-add-duplicate/customvalidation.cs %}
358+
{% endhighlight %}
359+
{% endtabs %}
360+
361+
![Prevent Duplicate row](../images/editing/prevent-duplicate-row.png)

ej2-asp-core-mvc/grid/EJ2_ASP.NETCORE/editing/edit.md

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -192,31 +192,6 @@ In the following code example, the Employee Name is a foreign key column. When e
192192
| -------------- | ------------- |
193193
| ![Foreign key column edit](../images/editing/on-foreign-key-column-editing.png) | ![After foreign key column edit](../images/editing/after-foreign-key-column-editing.png) |
194194

195-
## Prevent adding duplicate rows in Syncfusion ASP.NET Core Grid with custom validation
196-
197-
The Syncfusion ASP.NET Core Grid allows you to enforce constraints to prevent duplicate rows by customizing the validation logic within the Grid setup. This ensures data integrity by restricting duplicate entries in the **OrderID** column.
198-
199-
To prevent adding duplicate rows in the Grid, follow these steps:
200-
201-
1. Implement Custom Validation: Define the `orderIdCustomValidation` function to check whether the entered **OrderID** already exists in the [dataSource](https://help.syncfusion.com/cr/aspnetcore-js2/Syncfusion.EJ2.Grids.Grid.html#Syncfusion_EJ2_Grids_Grid_DataSource). This allows editing an existing row without triggering a duplicate error.
202-
203-
2. Add Dynamic Validation Rules: Create the `orderIDRules` object to enforce unique **OrderID** values. Dynamically add this rule to the form during the **save** action.
204-
205-
3. Handle Validation in the [actionBegin](https://help.syncfusion.com/cr/aspnetcore-js2/syncfusion.ej2.grids.grid.html#Syncfusion_EJ2_Grids_Grid_ActionBegin) event: In the `actionBegin` event, check if the **requestType** is **save**. Apply the validation rule before saving and cancel the action `args.cancel = true` if the validation fails.
206-
207-
For server-side validation to prevent adding duplicate rows, you can refer to the detailed guidance provided in our [knowledge base](https://support.syncfusion.com/kb/article/11608/how-to-do-server-side-validation-for-grid-in-asp-net-mvc-application). If you want to display the Grid's validation tooltip instead of the alert used in our knowledge base, you can call the `grid.editModule.formObj.validate()` method in the `Ajax/Fetch` success function to display the Grid's tooltip validation for the server side.
208-
209-
{% tabs %}
210-
{% highlight cshtml tabtitle="CSHTML" %}
211-
{% include code-snippet/grid/edit/prevent-add-duplicate/tagHelper %}
212-
{% endhighlight %}
213-
{% highlight c# tabtitle="Edit-temp.cs" %}
214-
{% include code-snippet/grid/edit/prevent-add-duplicate/customvalidation.cs %}
215-
{% endhighlight %}
216-
{% endtabs %}
217-
218-
![Prevent Duplicate row](../images/editing/prevent-duplicate-row.png)
219-
220195
## How to perform CRUD action externally
221196

222197
Performing CRUD (Create, Read, Update, Delete) actions externally in the Syncfusion<sup style="font-size:70%">&reg;</sup> Grid allows you to manipulate grid data outside the grid itself. This can be useful in scenarios where you want to manage data operations programmatically.

ej2-asp-core-mvc/grid/EJ2_ASP.NETCORE/editing/validation.md

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,4 +337,29 @@ namespace UrlAdaptor.Controllers
337337
{% endhighlight %}
338338
{% endtabs %}
339339

340-
![Show custom error message](../images/editing/custom-message.png)
340+
![Show custom error message](../images/editing/custom-message.png)
341+
342+
## Prevent adding duplicate rows with custom validation
343+
344+
The Syncfusion ASP.NET Core Grid allows you to enforce constraints to prevent duplicate rows by customizing the validation logic within the Grid setup. This ensures data integrity by restricting duplicate entries in the **OrderID** column.
345+
346+
To prevent adding duplicate rows in the Grid, follow these steps:
347+
348+
1. Implement Custom Validation: Define the `orderIdCustomValidation` function to check whether the entered **OrderID** already exists in the [dataSource](https://help.syncfusion.com/cr/aspnetcore-js2/Syncfusion.EJ2.Grids.Grid.html#Syncfusion_EJ2_Grids_Grid_DataSource). This allows editing an existing row without triggering a duplicate error.
349+
350+
2. Add Dynamic Validation Rules: Create the `orderIDRules` object to enforce unique **OrderID** values. Dynamically add this rule to the form during the **save** action.
351+
352+
3. Handle Validation in the [actionBegin](https://help.syncfusion.com/cr/aspnetcore-js2/syncfusion.ej2.grids.grid.html#Syncfusion_EJ2_Grids_Grid_ActionBegin) event: In the `actionBegin` event, check if the **requestType** is **save**. Apply the validation rule before saving and cancel the action `args.cancel = true` if the validation fails.
353+
354+
For server-side validation to prevent adding duplicate rows, you can refer to the detailed guidance provided in our [knowledge base](https://support.syncfusion.com/kb/article/11608/how-to-do-server-side-validation-for-grid-in-asp-net-mvc-application). If you want to display the Grid's validation tooltip instead of the alert used in our knowledge base, you can call the `grid.editModule.formObj.validate()` method in the `Ajax/Fetch` success function to display the Grid's tooltip validation for the server side.
355+
356+
{% tabs %}
357+
{% highlight cshtml tabtitle="CSHTML" %}
358+
{% include code-snippet/grid/edit/prevent-add-duplicate/tagHelper %}
359+
{% endhighlight %}
360+
{% highlight c# tabtitle="Edit-temp.cs" %}
361+
{% include code-snippet/grid/edit/prevent-add-duplicate/customvalidation.cs %}
362+
{% endhighlight %}
363+
{% endtabs %}
364+
365+
![Prevent Duplicate row](../images/editing/prevent-duplicate-row.png)

0 commit comments

Comments
 (0)