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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Data not binding properly

Thread ID:





120173 Sep 7,2015 08:46 PM UTC Sep 8,2015 07:25 AM UTC JavaScript 1
Tags: ejGrid
Asked On September 7, 2015 08:46 PM UTC

Hi Team,
I am using javascript and MVC. When I use the sampleSrc as the datasource, the pagesize is applied but when I change the datasource to perSrc, the data is loaded but the pagesize is not applied. I used the same pattern of codes in another module and it works well but not on this module. It seems that the data is not binding properly in this case. I tried clearing the cookies, cleaning and rebuilding my solution but it's still the same.  How do I get around this? If there's a better way to bind the data in a different manner, I would like to know that as well. 


var sampleSrc = [{ PersonId: "1", Name: "John" }, { PersonId: "2", Name: "Doe" }, { PersonId: "3", Name: "Jeremy" }
, { PersonId: "4", Name: "Mary" }, { PersonId: "5", Name: "Phillip" }, { PersonId: "6", Name: "Ashley" }]
var perSrc = ej.DataManager({
url: "../FileMaintenance/PersonnelGrid",
dataSource: sampleSrc,
allowPaging: true,
pageSettings: { pageSize: 3 },
columns: [
{ field: "PersonId", headerText: "Order ID", isPrimaryKey: true, textAlign: ej.TextAlign.Right, width: 80 },
{ field: "Name", headerText: "Name", width: 110 }

[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
public void PersonnelGrid()
var data = fm.GetFacilityStaff().ToList();
System.Web.HttpContext.Current.Response.ContentType = "application/json;charset=utf-8";
JavaScriptSerializer serialize = new JavaScriptSerializer();
System.Web.HttpContext.Current.Response.Write(String.Format("{{\"d\":{{\"results\":{0},\"__count\":{1}}}}}", serialize.Serialize(data), data.Count));

public IQueryable<FacilityStaff> GetFacilityStaff()
            List<FacilityStaff> sList = new List<FacilityStaff>();
            var personnels = (from p in db.People select p);
            foreach (var p in personnels)
                FacilityStaff fs = new FacilityStaff()
                    PersonId = Convert.ToInt32(p.PersonId),
                    Name = p.DisplayName
            return sList.AsQueryable();

Ragavee U S [Syncfusion]
Replied On September 8, 2015 07:25 AM UTC

Hi Lory,

We have analyzed the snippet that you have shared.

When retrieving the data from MVC controller, it is essential to specify the adaptor property of the ejDataManager. If you are not specifying any adaptor for the dataSource, then by default the adaptor type is considered as ODataAdaptor.

So we suggest you to mention the adaptor property of the ejDataManager. When mentioning the adaptor as “UrlAdaptor”, all the details corresponding to grid actions are obtained at the server side in the DataManager Class. Please refer to the following online documentation links for more information on data binding and data adaptors.



Since in your snippet, whole dataSource is written in the Response in the MVC controller rather than considering the skip and top properties passed in the queryString, the whole dataSource is bound to every page of the grid and thus pageSize is not reflected in grid.

When using “UrlAdaptor”, the records are loaded based on “load on demand” mechanism. The details of the number of data to be retrieved will be obtained in skip and take parameters of the DataManager Class. Please refer to the following code example on how the data is filtered using the skip and take parameters of the DataManager Class

public ActionResult Event(DataManager dm)


            IEnumerable DataSource = OrderRepository.GetAllRecords();

            DataResult result = new DataResult();

            DataOperations operation = new DataOperations();

            result.result = DataSource;

            result.count = result.result.AsQueryable().Count();

            if (dm.Skip > 0)

                result.result = operation.PerformSkip(result.result, dm.Skip);

            if (dm.Take > 0)

                result.result = operation.PerformTake(result.result, dm.Take);

            return Json(result, JsonRequestBehavior.AllowGet);

Please refer the below screenshot:

We have created a sample using UrlAdaptor, which can be downloaded from the following location.

Sample Link: http://www.syncfusion.com/downloads/support/forum/120173/ze/Sample463514340

Ragavee U S


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.

Please sign in to access our forum

or the page will be automatically redirected to sign-in page in 10 seconds.

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