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

Grid does not send modified object to CrudURL

I create simple grid with CRUD operation and update database via CrudURL. When I click add item on toolbar and input data then Save, input value does not send through CrudController. 

[Razer]
@(Html.EJ().Grid<Computer>("FlatGrid")
    .Datasource(ds => ds.URL(@Url.Action("DataSource", "Inventory")).CrudURL(@Url.Action("CrudUpdate", "Inventory")).Adaptor(AdaptorType.UrlAdaptor))
    .AllowPaging()
    .AllowSelection()
    .EditSettings(edit =>
    {
        edit
            .AllowAdding()
            .AllowDeleting()
            .AllowEditing()
            .EditMode(EditMode.DialogTemplate).DialogEditorTemplateID("#template");
    })
    .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);
        });
    })
    ...

[Controller]
        public ActionResult CrudUpdate(Computer computer, string action)          <----- property of computer has null value and ID = 0 but I have selected another ID to edit.
        {
            switch (action)
            {
                case "insert":
                  ...
                case "update":
                  ...
                case "delete":
                  ...


Do you have any suggestion about this case or Sample CRUD project that work with database?

3 Replies

SS Seeni Sakthi Kumar Seeni Raj Syncfusion Team May 18, 2016 06:09 AM UTC

Hi Soycake, 
  
We are able reproduce the problem with your code example.  

The first parameter of your CrudUpdate() must be value and so you can get the values POST from the client-side. But in your code example, you have used computer. Refer to the following code example and screenshot and make necessary changes in your project. 

@(Html.EJ().Grid<object>("Editing") 
           .Datasource(ds => ds.URL("/Home/Data").CrudURL("/Home/CrudUpdate").Adaptor(AdaptorType.UrlAdaptor)) 
           .AllowPaging() 
            . . . 
              . . .  
) 
 
        public ActionResult CrudUpdate(EditableOrder value, string action) { 
            return Json(value, JsonRequestBehavior.AllowGet); 
        } 


 

We have prepared a sample that can be downloaded from the following location. 


Refer to the following Help Document for CRUD action. 


Regards, 
Seeni Sakthi Kumar S. 



AR Anass Rhmoun July 28, 2017 06:14 AM UTC

Dear Seeni,

Kindly if could be provide complete example CRUD, as I'm not able to see how Remove operation is working when we're using CrudURL.

Regards,




SS Seeni Sakthi Kumar Seeni Raj Syncfusion Team July 31, 2017 01:27 PM UTC

Hi Anass,  
 
We have modified the sample that can be downloaded from the following location.  
 
 
If you are still facing any problem, please share the following information. 
 
  1. Code example of the Grid and server.
  2. Version of the Essential Studio
 
Regards,  
Seeni Sakthi Kumar S. 


Loader.
Live Chat Icon For mobile
Up arrow icon