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
close icon

ASP.NET MVC GRID CRUD example with Entity Framework (Database First) and save change to database.

Hi,

I would like to have an example with ASP.NET MVC GRID with Entity Framework Database First
and how to save the change to the database.

thanks for your help.
MK

1 Reply

VA Venkatesh Ayothi Raman Syncfusion Team May 19, 2017 12:21 AM UTC

Hi Martin, 
Thanks for contacting Syncfusion support. 

We have prepared a sample based on your requirement which can be download from following link, 

In this sample, we have bounded the Grid with Entity framework and enable the CRUD operations through EditSettings in Grid. Please refer to the following code example and Help documentation, 

Code example
@GRID 
 
@(Html.EJ().Grid<object>("FlatGrid") 
        .Datasource((IEnumerable<object>)ViewBag.datasource) 
                . . . 
              .SelectionType(SelectionType.Single) 
              .EditSettings(edit=>{edit.AllowAdding().AllowDeleting().AllowEditing(); }) 
              .ToolbarSettings(toolbar => 
                { 
                 toolbar.ShowToolbar().ToolbarItems(items => 
                 { 
                  items.AddTool(ToolBarItems.Add); 
                  items.AddTool(ToolBarItems.Edit); 
                  items.AddTool(ToolBarItems.Delete); 
                  items.AddTool(ToolBarItems.Update); 
                  items.AddTool(ToolBarItems.Cancel); 
                }); 
              }) 
        .Columns(col => 
        { 
            . . . 
        })) 



If you want to perform the server side operation while using Entity framework, then we suggest to you use remoteSave adaptor. Please refer to the following Help documentation for more information, 

Regards, 
Venkatesh Ayothiraman. 


Loader.
Live Chat Icon For mobile
Up arrow icon