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

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

Thread ID:

Created:

Updated:

Platform:

Replies:

124436 Jun 9,2016 03:22 PM UTC Jun 10,2016 12:56 PM UTC ASP.NET MVC 1
loading
Tags: Grid
Carlos Palomino
Asked On June 9, 2016 03:22 PM UTC

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

Greetings.

Jayaprakash Kamaraj [Syncfusion]
Replied On 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 
 
@(Html.EJ().Grid<Order>("FlatGrid") 
                        .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(); 
.. 
 
        })) 
 
Order.cs 
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; } 
    } 
} 


Regards, 

Jayaprakash K. 


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.

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

;