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

grid with RemoteServer function is not passed into the parameter value

Thread ID:

Created:

Updated:

Platform:

Replies:

125326 Aug 8,2016 09:28 PM UTC Aug 12,2016 04:04 AM UTC ASP.NET MVC 4
loading
Tags: Grid
anggoro
Asked On August 8, 2016 09:28 PM UTC

I create web applications with asp mvc vNext and syncfusion last edition, when I use the grid with RemoteServer function, the data that the change is not passed into the parameter value, if there is something wrong in the code below:

Controller:

public async Task<IActionResult> GetDataChemicals(DataManager dm)
{
    IEnumerable data = await _chemical.GetAllAsync(); 
    DataOperations operation = new DataOperations();
    if (dm.Sorted != null && dm.Sorted.Count > 0) //Sorting
    {
       data = operation.PerformSorting(data, dm.Sorted);
    }
    if (dm.Where != null && dm.Where.Count > 0) //Filtering
    {
      data = operation.PerformWhereFilter(data, dm.Where, dm.Where[0].Operator);
    }
    int count = data.Cast<Chemical>().Count();
    if (dm.Skip != 0)
    {
       data = operation.PerformSkip(data, dm.Skip);
    }
    if (dm.Take != 0)
    {
       data = operation.PerformTake(data, dm.Take);
    }
    return Json(new { result = data, count = count });
}

    public IActionResult Insert(Chemical value)
    {
           //this code
    }

    public ActionResult Update(Chemical value)
    {

           //this code
    }

    public IActionResult Remove(int key)
    {
           this code
    }

View:;
@{
    Html.EJ().Grid<Chemical>("ChemicalGrid")
        .Datasource(ds => ds.Json((IEnumerable<object>)ViewBag.datasource).UpdateURL("/Chemicals/Update")
        .InsertURL("/Chemicals/Insert").RemoveURL("/Chemicals/Remove").Adaptor(AdaptorType.RemoteSaveAdaptor))
        .AllowSorting()
        .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);
            });
        })
        .AllowPaging()
        .AllowMultiSorting()
        .SortSettings(sort =>
        {
            sort.SortedColumns(col => col.Field("ChemicalId").
        .Columns(col =>
        {
            col.Field("ChemicalId").HeaderText("Id").IsPrimaryKey(true).TextAlign(TextAlign.Right).Add();
            col.Field("ChemicalStation").HeaderText("Station").EditType(EditingType.String).ValidationRules(v => v.AddRule("required"true).AddRule("minlength", 2)).TextAlign(TextAlign.Right).Add();
            col.Field("ChemicalDistance").HeaderText("Distance").EditType(EditingType.Numeric).NumericEditOptions(new EditorProperties() { DecimalPlaces = 2, }).TextAlign(TextAlign.Right).Add();
            col.Field("ChemicalBod").HeaderText("Bod").EditType(EditingType.Numeric).NumericEditOptions(new EditorProperties() { DecimalPlaces = 2, }).TextAlign(TextAlign.Right).Add();
            col.Field("ChemicalDo").HeaderText("Do").EditType(EditingType.Numeric).NumericEditOptions(new EditorProperties() { DecimalPlaces = 2, }).TextAlign(TextAlign.Right).Add();
            col.Field("ChemicalQ").HeaderText("Q").EditType(EditingType.Numeric).NumericEditOptions(new EditorProperties() { DecimalPlaces = 2, }).TextAlign(TextAlign.Right).Add();
        })
        .Render();
}

On performing CRUD operations in Grid, the record changes will be sent to server-side as in the following screenshot.
Header result 
Preview

ahmad
Replied On August 9, 2016 12:17 PM UTC

use action name only without controller name 

Jayaprakash Kamaraj [Syncfusion]
Replied On August 9, 2016 12:45 PM UTC

Hi Anggoro,   
  
Thank you for contacting Syncfusion support.   
  
For ASP.NET MVC vNext sample, we can get the dynamic value using “[FromBody]CrudModel” as follows,    
 
{Html.EJ().Grid<Object>("FlatGrid") 
        .Datasource(ds => ds.Json((IEnumerable<object>)ViewBag.data).UpdateURL("/Home/CellEditUpdate").InsertURL("/Home/CellEditInsert").RemoveURL("/Home/CellEditDelete").Adaptor(AdaptorType.RemoteSaveAdaptor)) 
                .EditSettings(edit => { edit.AllowAdding().AllowDeleting().AllowEditing(); }) 
                .AllowPaging() 
                                .. 
                                }).Render(); 
    } 

HomeController.cs 
namespace WebApplication8.Controllers 
{ 
    public class HomeController : Controller 
    { 
        .. 
 
        public ActionResult CellEditUpdate([FromBody]CRUDModel<Orders> value) 
        { 
          // do your operations here 
        } 
        public ActionResult CellEditInsert([FromBody]CRUDModel<Orders> value) 
        { 
             // do your operations here  
        } 
        public ActionResult CellEditDelete([FromBody]CRUDModel<Orders> value) 
        { 
              // do your operations here 
        } 
    } 
} 



Regards, 

Jayaprakash K. 


anggoro
Replied On August 11, 2016 10:53 AM UTC

Oke thanks.. i try this.

Jayaprakash Kamaraj [Syncfusion]
Replied On August 12, 2016 04:04 AM UTC

Hi Anggoro, 
 
Thanks for the update. 
 
Please get back to us for further assistance. 
 
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.

Please sign in to access our forum

or the page will be automatically redirected to sign-in page in 10 seconds.

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

;