Syntax for datasource URL handler

i have a grid with a datamanager like:

<e-datamanager url="/Customers/DataSource"
                 insert-url="/Customers/Insert"
                 remove-url="/Customers/Remove"
                 update-url="/Customers/Update"
                 adaptor="UrlAdaptor">

my handler in the controller is

public ActionResult DataSource(DataManager dm)

as it was in mvc5. However, although I can see the params being passed properly from the web page (skip: 0 and take: 12), the properties of the object passed to the DataSource method are 0, so no skip/take happens server-side.

I saw elsewhere that the insert-url et al. have a "CRUDModel<>" wrapper around the param type, which avoids a similar problem there... is there something similar needed for the DataManager?

1 Reply

JK Jayaprakash Kamaraj Syncfusion Team December 23, 2016 11:04 AM UTC

Hi Brian,   
  
Thank you for contacting Syncfusion support.   
  
For ASP.NET core sample, we can get the dynamic value using “[FromBody] ” as follows,    
 
<ej-grid id="GridContainer" 
.. 
" 
         allow-paging="true" 
         is-responsive="true" 
         enable-responsive-row="true"> 
    <e-datamanager url="/Home/DataSource" insert-url="/Home/CellEditInsert" update-url="/Home/CellEditUpdate" remove-url="/Home/CellEditDelete" adaptor="UrlAdaptor"></e-datamanager> 
    .. 
 
</ej-grid>  
HomeController.cs 
namespace WebApplication8.Controllers 
{ 
    public class HomeController : Controller 
    { 
        .. 
  public ActionResult DataSource([FromBody]DataManager dm) 
        { 
 
// do your operations here 
        } 
        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. 


Loader.
Up arrow icon