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.
Unfortunately, activation email could not send to your email. Please try again.

Syncfusion grid supports data annotations?

Thread ID:

Created:

Updated:

Platform:

Replies:

104464 Jul 20,2012 08:03 AM Aug 23,2012 08:43 AM ASP.NET MVC (Classic) 1
loading
Tags: Grid
Mohit Jain
Asked On July 20, 2012 08:03 AM

Hi,

I am using Asp.Net MVC Syncfusion grid.

 

I have applied data annotations on my business objects that I bind with syncfusion grid.

 

Data annotations, that run on client side (e.g. Required field annotation), are not working for the fields in the Syncfusion grid. Is there some setting required for running data annotations? Or Syncfusion grid doesn't support data annotations and we have to use javascript validations?

 

Please suggest what is best approach here.

 

Many Thanks.


Gowri S [Syncfusion]
Replied On August 23, 2012 08:43 AM

Hi Mohit,

Thanks for using Syncfusion Products.

Grid MVC will support Data annotation attributes. Please refer to the following code snippets:

[EditableOrder.cs]

public class EditableOrder

{

// Validation set to the orderId and customerId

[Required(ErrorMessage = "Order ID is required.")]

public int OrderID

{

get;

set;

}

[Required(ErrorMessage = "Customer  ID is required.")]

[StringLength(5, ErrorMessage = "Customer ID must be 5 characters.")]

public string CustomerID

{

get;

set;

}

.. . .

}

Add the following script files to your layout.cs within the head tag. Please refer to the following code snippets:

<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>

 

       <script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.js")" type="text/javascript"></script>

We have prepared the sample for your requirement and the same can be downloaded from the following link:

http://www.syncfusion.com/downloads/Support/DirectTrac/89849/Editing1742303737.zip


Also we would request you to check the following online sample link:

http://mvc.syncfusion.com/demos/ui/grid/Editing/CellEditType#

Please try this and let us know if you have any other queries.

Regards,

Gowri.S

CONFIRMATION

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.

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.

;