We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Grid - Custom Validation

Thread ID:





141840 Jan 7,2019 01:46 PM UTC Jan 8,2019 05:56 AM UTC ASP.NET MVC - EJ 2 1
Tags: Grid
Matias Puzanowski
Asked On January 7, 2019 01:48 PM UTC


I'm trying to add a Custom Validation to a column, but I got a syntax error. I was following your documentation example:

We're using Syncfusion In addition, this link is broken: https://ej2.syncfusion.com/16.1.24/aspnet/documentation/form-validator.html#defining-custom-rules

Thanks in advance.

Thavasianand Sankaranarayanan [Syncfusion]
Replied On January 8, 2019 05:56 AM UTC

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 => 
}).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; 
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, 

Thavasianand S. 


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon