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.

Grid is not filled with data

Thread ID:

Created:

Updated:

Platform:

Replies:

124962 Jul 11,2016 07:58 AM Jul 12,2016 09:02 AM ASP.NET Web Forms 2
loading
Tags: Grid
Martin Sickel
Asked On July 11, 2016 07:58 AM

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

Martin Sickel
Replied On July 11, 2016 08:00 AM

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>

Mani Sankar Durai [Syncfusion]
Replied On July 12, 2016 09:02 AM

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. 


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.

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.

;