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
close icon

Grid is not filled with data

Dear All
I am very new with Syncfusion and I am struggeling a little to get data displayed in may grid.
I request the data from an API call
[Route("api/main")]
public List GET_INDB_PNR_MASTER()
{
Database.DB myMainData = new Database.DB();
return myMainData.GET_INDB_PNR_MASTER();
}
If I check with POSTMAN I got this data back
[
{
"phonenumber": "1234567890",
"pnr_typ": "FIXNET",
"pnr_state": "FREE",
"pnr_group": "1002",
"pnr_group_range": "1000001",
"pnr_group_range_title": "Reserved",
"coupled_phonenumber": "11111111111",
"manual_reserved_state": "N",
"manual_reserved_end": "",
"manual_reserved_title": "",
"user_title": "",
"user_description": "",
"user_go_ma_id": "",
"user_source_sys_title": ""
},
{
"phonenumber": "0123456789",
"pnr_typ": "FIXNET",
........................
This is how my ASP Site will look

The grid will be shown, but without having data in it.
What will I do wrong?
Thanks for helping
Martin

2 Replies

MS Martin Sickel replied to Martin Sickel July 11, 2016 12:00 PM UTC

Dear All
I am very new with Syncfusion and I am struggeling a little to get data displayed in may grid.
I request the data from an API call
[Route("api/main")]
public List GET_INDB_PNR_MASTER()
{
Database.DB myMainData = new Database.DB();
return myMainData.GET_INDB_PNR_MASTER();
}
If I check with POSTMAN I got this data back
[
{
"phonenumber": "1234567890",
"pnr_typ": "FIXNET",
"pnr_state": "FREE",
"pnr_group": "1002",
"pnr_group_range": "1000001",
"pnr_group_range_title": "Reserved",
"coupled_phonenumber": "11111111111",
"manual_reserved_state": "N",
"manual_reserved_end": "",
"manual_reserved_title": "",
"user_title": "",
"user_description": "",
"user_go_ma_id": "",
"user_source_sys_title": ""
},
{
"phonenumber": "0123456789",
"pnr_typ": "FIXNET",
........................
This is how my ASP Site will look

The grid will be shown, but without having data in it.
What will I do wrong?
Thanks for helping
Martin

I guess I forgot the ASP Part, sorry


    <ej:DataManager runat="server" ID="DataManager" URL="api/main" Adaptor="WebApiAdaptor" ></ej:DataManager>
    <ej:Grid ID="Grid1" runat='server' CssClass="" DataSourceCachingMode="None" MinWidth="300" DataManagerID="DataManager">
        <Columns>
            <ej:Column Field="phonenumber"  />
<%--            <ej:Column Field="PNR_STATE"  />
            <ej:Column Field="PNR_GROUP"  />
            <ej:Column Field="PNR_GROUP_RANGE" />
            <ej:Column Field="PNR_GROUP_RANGE_TITEL" />
            <ej:Column Field="COUPLED_PHONENUMBER" />
            <ej:Column Field="MANUAL_RESERVED_STATE" />
            <ej:Column Field="MANUAL_RESERVED_END" />
            <ej:Column Field="MANUAL_RESERVED_TITEL"  />
            <ej:Column Field="USER_TITEL"  />
            <ej:Column Field="USER_DESCRIPTION" />
            <ej:Column Field="USER_GO_MA_ID"  />
            <ej:Column Field="USER_SOURCE_SYS_TITEL" />--%>
        </Columns>
    </ej:Grid>


MS Mani Sankar Durai Syncfusion Team July 12, 2016 01:02 PM UTC

Hi Martin, 

We have analyzed your code example and found the cause of an issue. Since you have returned only the Json array of data instead of returning the Items and the count pair. Items which is to hold the Json array of data and count which is to hold the total records count. So we suggest you to return the data as the Items and count pair when using adaptor type as ` WebApiAdaptor’ to the Adaptor Property of Grid DataManager.  

 For your convenience please refer the below code example, 

[controller.cs] 
 
public object Get() 
        { 
            var queryString = HttpContext.Current.Request.QueryString; 
            var data = da.Orders.ToList(); 
            return new { Items = data, Count = data.Count() }; 
             
        } 
 
Please find the help document of how to return the data from server side when using WebApiAdaptor 

We have also prepared a sample that can be downloaded from the below link, 


Regards, 
Manisankar Durai. 


Loader.
Live Chat Icon For mobile
Up arrow icon