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

How can I put Validation on MVC Grid

Thread ID:





106430 Jan 7,2013 10:19 AM UTC Jan 8,2013 06:55 AM UTC ASP.NET MVC (Classic) 1
Tags: Grid
Asked On January 7, 2013 10:19 AM UTC

how can I put required field Validation and compare field validation on syncfusion mvc Editable Grid 

Eswari S [Syncfusion]
Replied On January 8, 2013 06:55 AM UTC

Hi Muhammad,
Thank you for using Syncfusion products.
Your requirement of adding validation to the grid editing can be achieved. Please refer to the following steps to achieve your requirement.
Step #1: Add the following scripts for validation
    <script src="<%= Url.Content("~/Scripts/MicrosoftMvcValidation.debug.js") %>" type="text/javascript"></script>  
    <script src="<%= Url.Content("~/Scripts/jquery.unobtrusive-ajax.min.js") %>" type="text/javascript"></script>  
    <script src="<%= Url.Content("~/Scripts/jquery.validate.min.js") %>" type="text/javascript"></script>  
    <script src="<%= Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js") %>" type="text/javascript"></script>    
Step #2: Set ClientValidationEnabled and UnobtrusiveJavaScriptEnabled as true in web.config.
    <add key="ClientValidationEnabled" value="true"/>
    <add key="UnobtrusiveJavaScriptEnabled" value="true"/>
. . 
Step #3: set validation attributes to the grid columns fields
 public class EditableCompanyShare
         [Required(ErrorMessage = "CurrentRate is required.")]
        public Int32 CurrentRate
         [Compare("CurrentRate", ErrorMessage = "Predicted Rate should be equal to Current Rate")]
         public Int32 PredictedRate
For your reference , we have prepared the sample and the same can be downloaded from the following link:


Please try this and let us know if you have any queries.
Eswari 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

or the page will be automatically redirected to 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