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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

add validation to check for valid telephone number

Thread ID:





128126 Jan 4,2017 07:08 AM UTC Jan 5,2017 11:37 AM UTC ASP.NET MVC 1
Tags: Grid
Edmund Herbert
Asked On January 4, 2017 07:08 AM UTC

Hi Guys happy new year,
Could you tell me how to add validation in MVC 5 grid controll,
addrule to validate telephone number or cell number


Edmund Herbert

Prasanna Kumar Viswanathan [Syncfusion]
Replied On January 5, 2017 11:37 AM UTC

Hi Edmund, 

Thanks for contacting Syncfusion support. 

To add validation in grid control, use validationRules property of columns. If you have different field for both telephone and mobile number, use minlength and maxlength jQuery validation method. For example, in this sample we set validation for phone number using maxlength and minlength validation method.  

Find the code example and sample:  

       .Columns(col => 
            col.Field("Phone").HeaderText("Phone").ValidationRules(v => v.AddRule("required", true).AddRule("maxlength", 6).AddRule("minlength", 6)).TextAlign(TextAlign.Right).Width(75).Add(); 

Refer to the Help document for the validation.  

If you need to validate phone and mobile number in a single field, use custom validation. In addition to jQuery validation methods, you can also add your own custom validation methods for a specific column. Function call to custom validator function to be mentioned within ValidationRules property of Columns. 
For more information, please refer the below document and online sample.  

Prasanna Kumar N.S.V 


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