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

Datasource with model and Data Annotations with URL insert, edit, delete in a grid with dialogtemplate

How datasource can be used to model and Data Annotations with URL insert, edit, delete in a grid with dialogtemplate?


1 Reply

JK Jayaprakash Kamaraj Syncfusion Team June 10, 2016 12:56 PM UTC

Hi Carlos, 

Thank you for contacting Syncfusion support. 

We have prepared a sample with the Data Annotation and it can be downloaded from the following location. 

We have prepared Order class which holds the data annotation properties of the required columns of Grid and its class name can be given as type of object for the Grid as shown below. We need to refer  jquery.validate.min.js and jquery.validate.unobtrusive.min.js scripts for validation. So, please refer to these script files in your sample. Also refer to the below help document and code example. 

    <script src="Scripts/jquery.validate.min.js"></script> 
    <script src="Scripts/jquery.validate.unobtrusive.min.js"></script> 

@using SyncfusionMvcApplication90.Models 
                        .Datasource(ds => ds.URL("/Grid/DataSource").UpdateURL("/Grid/Update").InsertURL("/Grid/Insert").RemoveURL("/Grid/Delete").Adaptor(AdaptorType.UrlAdaptor)) 
       .Columns(col => 
            col.Field("CustomerID").HeaderText("Customer ID").Width(80).Add(); 
namespace SyncfusionMvcApplication90.Models 
    public partial class Order 
        public int OrderID { get; set; } 
         [Required(ErrorMessage = "CustomerID is required")]  
        public string CustomerID { get; set; } 
        public virtual Employee Employee { get; set; } 


Jayaprakash K. 

Live Chat Icon For mobile
Up arrow icon