data not load in Grid Demo

hi 

i use grid in blazor with you code demo

@page "/B" 
@using Syncfusion.Blazor
@using Syncfusion.Blazor.Data
@using Syncfusion.Blazor.Grids

<SfGrid TValue="EmployeeData" ID="Grid" AllowPaging="false">
    <SfDataManager Url="https://ej2services.syncfusion.com/production/web-services/api/Employees" Adaptor="Adaptors.WebApiAdaptor"></SfDataManager>
    <GridColumns>
        <GridColumn Field=@nameof(EmployeeData.EmployeeID) TextAlign="TextAlign.Center" HeaderText="Employee ID" Width="120"></GridColumn>
        <GridColumn Field=@nameof(EmployeeData.Name) HeaderText="First Name" Width="130"></GridColumn>
        <GridColumn Field=@nameof(EmployeeData.Title) HeaderText="Title" Width="120"></GridColumn>
    </GridColumns>
</SfGrid>

@code{
    public class EmployeeData
    {
        public int EmployeeID { get; set; }
        public string Name { get; set; }
        public string Title { get; set; }
    }
}







but row not load
plz see Attach file file



Attachment: blazor_demo_8d556496.zip

3 Replies 1 reply marked as answer

RS Renjith Singh Rajendran Syncfusion Team March 17, 2021 09:09 AM UTC

 
Greetings from Syncfusion support. 
 
For a WebApiAdaptor used in DataManager, it is a must to return from the WebApi service as Items and Count to bind the service to a Grid component. Please refer the documentation link below in which we have used Orders service for binding data to Grid, 
 
For Employees service, the return type is as result, count and not as items, count pair. So the Employees service could not be used to populate data to Grid. But, Orders service return data as items and count pair, so it binds data to Grid. Please refer the below screenshot for the difference in response for both Orders and Employees. 
 
 
 
 
So we suggest you to ensure to use a webapi service with return data as Items and Count pair to bind data to Grid. Please get back to us if you need further assistance. 
 
Regards, 
Renjith R 


Marked as answer

AA asemon abi March 20, 2021 09:39 PM UTC

Tanx For your replay "Renjith R"

I Use Scaffolding For Generate Web API Core 

For Example :

       // GET: api/SampleTable
        [HttpGet]
        public async Task<ActionResult<IEnumerable<SampleTable>>> GetSampleTable()
        {
            return await _context.SampleTable.ToListAsync();
        }

Is there a need for a specific change?

Can you show me an example?




RS Renjith Singh Rajendran Syncfusion Team March 22, 2021 12:32 PM UTC

Hi asemon, 

We have prepared a sample to bind WebApi service to Grid. Please download and refer the sample from the link below, 
Note : A local MDF file is used in the above sample to assign and process the data. So before running the sample, please make sure the connection for this file is established and the correct connection string(local path of the MDF file in your machine) is provided in OrderContext.cs file in the application. 


Please get back to us if you need further assistance. 

Regards, 
Renjith R 


Loader.
Up arrow icon