Hi Matias,
Greetings from Syncfusion.
Sorry for the inconvenience caused.
Query #1: I'm trying to add a Custom Validation to a column, but I got a syntax error. I was following your documentation example:
Currently, Grid do not have the tag helper support for custom validation rules. So we suggest you to use Grid Load event to achieve this requirement like as follows,
@Html.EJS().Grid("Grid").DataSource((IEnumerable<object>)ViewBag.data).AllowPaging(true).Load("load").Columns(col =>
{
col.Field("OrderID").HeaderText("OrderID").IsPrimaryKey(true).Width("120").Add();
col.Field("CustomerID").HeaderText("CustomerID").Width("120").Add();
col.Field("EmployeeID").HeaderText("EmployeeID").Width("120").Add();
col.Field("ShipCity").HeaderText("ShipCity").Width("120").Add();
}).EditSettings(edit => { edit.AllowAdding(true).AllowEditing(true).AllowDeleting(true).Mode(Syncfusion.EJ2.Grids.EditMode.Normal); }).Toolbar(new List<string>() { "Add", "Edit", "Delete", "Update", "Cancel" }).Render()
<script type="text/javascript">
function load(args) {
this.columns[1].validationRules = { required: true, minLength: [customFn, 'Need atleast 5 letters'] };
}
function customFn(args) {
return args['value'].length >= 5;
}
</script> |
Also we could see that we have used razor and tag helper to provide custom validation in our mvc and core help documentation code. We have already logged documentation task to change this code in the documentation. The changes will be available in any of our upcoming release.
Refer the below link to know about Grid Load event,
We suggest you to use below documentation and demo link to know about our form-validator instead of that link,
Regards,
Thavasianand S.