Grid does not display data from the WebApi source

Hello,
I'm trying to display Grid entries with WebAPI, but I do not like it.

The Api Web interface works properly, as seen on the attached screenshot, the data is downloaded but the Grid does not appear.

Please help.

Sincerely,
Patrik

Attachment: Grid_WebAPI_e279c868.zip

3 Replies

VA Venkatesh Ayothi Raman Syncfusion Team April 18, 2018 11:45 AM UTC

Hi Patrik, 

Thanks for using Syncfusion products. 

We went through your screenshot that you have shared with us and you are just returning the JSON data from WebAPI service. Since WebAPI adaptor, we need to return the response from server side as an object. In that Object has two properties named as following Items and count. Here, Items should have a value of  JSON data and count has a value of total records count in Database. Please refer to the following code example and Screenshot, 
Code example
  public object Get() 
        { 
            var queryString = HttpContext.Current.Request.QueryString; 
            int skip = Convert.ToInt32(queryString["$skip"]); 
            int take = Convert.ToInt32(queryString["$top"]); 
            var data = OrdersDetails.GetAllRecords(); 
            return new { Items = data.Skip(skip).Take(take), Count = data.Count() }; 
        } 

Screenshot
 

We have also prepared a sample for your convenience which can be download from following link, 




Regards, 
Venkatesh Ayothiraman. 



PV Patrik Volka April 21, 2018 05:38 PM UTC

Work fine!

Thank you


VA Venkatesh Ayothi Raman Syncfusion Team April 23, 2018 03:57 AM UTC

Hi Patrik, 

Thanks for the feedback. 

We are very happy to hear your requirement is achieved. 
  
Regards, 
Venkatesh Ayothiraman. 


Loader.
Up arrow icon