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
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

[FromBody]DataManagerRequest in action controller

Thread ID:





144989 May 31,2019 08:28 AM UTC Jun 4,2019 07:22 AM UTC ASP.NET Core - EJ 2 3
Tags: DataGrid
Mini Dev
Asked On May 31, 2019 08:28 AM UTC

Good morning,
is it possible to use  GET method with DataManagerRequest?
I need to view filter grid in url but I can't at the moment because DataManagerRequest is in POST method action controller.
Is it possible something like the following code?
Public IActionResult Index (DataManagerRequest dm) {}

Or is there another way to use filter with GET method?


Pavithra Subramaniyam [Syncfusion]
Replied On June 3, 2019 06:18 AM UTC

Hi Mini, 

Thanks for contacting Syncfusion support. 

By default, while using UrlAdaptor for remote data, POST request will be sent for fetching the data from server. If you want to send the GET request for data fetching then you can use “WebApiAdaptor” . However you need to handle the Grid actions like filtering, sorting in server side and return the data as Items, Count pair. Please refer to the below documentation for more details. 
Please get back to us if you need any further assistance on this.   
Pavithra S. 

Mini Dev
Replied On June 3, 2019 12:39 PM UTC


how can I handle filter server-side?
I need get filter by query parameter and convert it to a strongly-typed model.
Is there something ready? Or do I have to develop my own code to obtain that?

public IActionResult Test([FromQuery(Name = "$skip")] int skip, [FromQuery(Name = "$top")] int top, [FromQuery(Name = "$filter")] string filter)


filter is "(OrderId eq 477) and (CustomerId eq 135) and (startswith(tolower(CartCode),'235'))"

I need to have a model with the following property:

Has Syncfusion made something of similar? Or do I have to create my custom model and valorized it?

Pavithra Subramaniyam [Syncfusion]
Replied On June 4, 2019 07:22 AM UTC

Hi Mini, 
For WebApiAdaptor you need to handle the filtering and create the model by manually at server end point. We have prepared a simple sample for server side Menu filtering with WebApiAdaptor for example. Please refer to the below code example and sample link for more information.  
  public class OrdersController : Controller  
        // GET: api/Orders  
        public object Get()  
            var queryString = Request.Query;  
            var data = OrdersDetails.GetAllRecords().ToList();  
            string filter = queryString["$filter"];  
            string auto = queryString["$inlineCount"];  
            // filtering  
            if (filter != null)  
                var newfiltersplits = filter;  
                var filtersplits = newfiltersplits.Split('('')'' ');  
                var filterfield = filtersplits[1];  
                var filtervalue = filtersplits[3];  
                if (filtersplits.Length == 5)  
                    if (filtersplits[1] == "tolower")  
                        filterfield = filter.Split('('')''\'')[2];  
                        filtervalue = filter.Split('('')''\'')[4];  
                if (filtersplits.Length != 5)  
                    filterfield = filter.Split('('')''\'')[3];  
                    filtervalue = filter.Split('('')''\'')[5];  
                switch (filterfield)  
                    case "CustomerID":  
                        data = (from cust in data  
                                where cust.CustomerID.ToLower().StartsWith(filtervalue.ToString())  
                                select cust).ToList();  
            // paging  
            int skip = Convert.ToInt32(queryString["$skip"]);  
            int take = Convert.ToInt32(queryString["$top"]);  
            if (auto == null)  
                return new { Items = data };  
                return take != 0 ? new { Items = data.Skip(skip).Take(take).ToList(), Count = data.Count() } : new { Items = data, Count = data.Count() };  
You can get the filter parameters in the queryString of the GET request and modify the above code as per your requirement.  
Pavithra S. 


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

This page will automatically be redirected to the 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

Live Chat Icon For mobile
Live Chat Icon