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

Grid Support in ASP NET Core

Thread ID:

Created:

Updated:

Platform:

Replies:

125200 Jul 29,2016 10:52 AM UTC Aug 1,2016 01:42 PM UTC JavaScript 2
loading
Tags: ejGrid
Andrea Perazzolo
Asked On July 29, 2016 10:52 AM UTC

Hi,
I am having many difficulties using the ejGrid in a ASP NET COre project in which I want to use the Remote data access (Load and save data)
I cannot use the OData Adaptor, because the OData support in ASP NET Core is not implemented (or I don't know how to use it).
I am trying the Web API Adaptor, but I am not able to retrieve any data, even if the web api is called correctly.
The grid gives me an error reponding to Action Failure that says "200: OK", which seems the status code for a correct call.
Could you give me a working sample using the last version of librarythat helps me with this issue?

     Thanks in advance

    Andrea Perazzolo

Andrea Perazzolo
Replied On July 29, 2016 12:23 PM UTC

I forgot to say that I am using the Essential Javascript grid control inside an ASP NET CORE project.

Seeni Sakthi Kumar Seeni Raj [Syncfusion]
Replied On August 1, 2016 01:42 PM UTC

Hi Andrea, 

We have prepared a sample with the ejGrid and WebApiAdaptor in the ASP.Net core project that can be downloaded from the following location. 
                           

To handle the webapi service in the Grid, you have to use the ej.WebApiAdaptor via ej.DataManager and the server must return the object wrapped with the result and count pair as shown in the following code example. 

    <div id="Grid"></div> 
    <script type="text/javascript"> 
        $(function () { 
            $("#Grid").ejGrid({ 
                dataSource: ej.DataManager({ 
                    url: "/api/Orders", 
                    adaptor: new ej.WebApiAdaptor() 
                }), 
                allowPaging: true, 
                . . . . 
            }); 
        }); 
    </script> 
 
        // GET: api/values 
        [HttpGet] 
        public object Get() 
        { 
            BindDataSource(); 
 
            var queryStrings = Request.Query; 
            var qsList = new List<string>(); 
            foreach (var key in queryStrings.Keys) 
            { 
                qsList.Add(queryStrings[key]); 
            } 
            var queryString = HttpContext.Request.QueryString; 
            var dataSource = order; 
            var data = dataSource.Skip(Convert.ToInt32(qsList[2])).Take(Convert.ToInt32(qsList[3])).ToList(); 
            return new { result = data, count = dataSource.Count() }; 
        } 


The sample is prepared ASP.Net Core Preview-2 final project. So we ask you to update the Essential Studio to 14.2.0.28 which supports the preview2 final update of ASP.Net core. Essential Studio 2016 Volume 2 Service pack Release v14.2.0.28 is rolled out and is available for download under the following link: 
                            

Refer to the following Help Document. 


Regards, 
Seeni Sakthi Kumar S. 


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.

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

;