This is a migrated thread and some comments may be shown as answers.

Grid does not display data when return record is over 5000

2 Answers 572 Views
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 1
Xinzhou asked on 16 Jun 2014, 04:24 PM
.Columns(columns =>
    columns.Bound(p => p.cName).Title("Market").Width(150);    
    columns.Bound(p => p.cStation).Title("Station").Width(100);
    columns.Bound(p => p.cDemo).Title("Demo").Width(100);
    columns.Bound(p => p.cProduct).Title("Prod").Width(100);
    columns.Bound(p => p.cDayofweek).Title("Days").Width(100);
    columns.Bound(p => p.cTime).Title("Time").Width(100);
    columns.Bound(p => p.cCode).Title("Code").Width(100);
    columns.Bound(p => p.cProgram).Title("Program").Width(100);
    columns.Bound(p => p.Cncl).Title("Cncl").Width(100);
.HtmlAttributes(new { style = "height:430px;" })
.DataSource(dataSource => dataSource
    .Read(read => read.Action("PopulateGrid", "BuyBuilder")
    .Update(update => update.Action("Products_Update", "BuyBuilder"))
    .Destroy(destroy => destroy.Action("Products_Destroy", "BuyBuilder"))
    .ServerOperation(false) //false = don't read on page load
    //.Events(events => events.Error("error_handler"))
    .Model(model =>
                model.Id(p => p.buylineid);
                model.Field(p => p.buylineid).Editable(false);                
.Editable(editable => editable.Mode(GridEditMode.InCell))
.Sortable(sortable => sortable
    .AllowUnsort(true   )
.Scrollable(scrollable => scrollable.Virtual(true))
.ToolBar(toolBar =>

 public ActionResult PopulateGrid(string quarters, int? market, string station,
            string client, string contract, int? show, string cost, string dp, 
            string start, string end,
            string sortBy, bool blnFilter, bool includeTrade, bool exact, bool tradeonly,  bool option, 
            [DataSourceRequest]DataSourceRequest request)
            var userid = Session["UserId"].ToString();
            int id = Int32.Parse(userid);

            return Json(db.GetData(quarters, market, station, client, contract, show, cost, dp, start, end, sortBy, blnFilter, includeTrade, exact, tradeonly, option, id).ToDataSourceResult(request), 

GetData Function:
 public List<BuyBuilder> GetData(string quarters, int? market, string station,
            string client, string contract, int? show, string cost, string dp, string start,
            string end, string sortBy, bool blnFilter, bool blnIncludeTrade, bool blnExact, bool blnTradeonly,
            bool blnOption, int userId)
            List<BuyBuilder> list = new List<BuyBuilder>();

            string conn = ConfigurationManager.ConnectionStrings["DevConnString"].ConnectionString;
            SqlConnection cn = new SqlConnection(conn);

            SqlCommand oCmd = new SqlCommand("Buy_BuyLine_Load", cn);

            oCmd.CommandType = CommandType.StoredProcedure;
            oCmd.Parameters.Add("@strQuarters", SqlDbType.VarChar).Value = quarters;
            oCmd.Parameters.Add("@strStation", SqlDbType.VarChar).Value = station;
            oCmd.Parameters.Add("@intShow", SqlDbType.Int).Value = show;
            oCmd.Parameters.Add("@intUserId", SqlDbType.Int).Value = userId;
            oCmd.Parameters.Add("@intMarket", SqlDbType.Int).Value = market;

            SqlDataAdapter oAdptr = new SqlDataAdapter(oCmd);

            DataSet dsResults = new DataSet();
            oCmd.CommandTimeout = 600;
            // oAdptr.Fill(dsResults, "Results");

            var dataTable = new DataTable();

            string costConvert = "";
            foreach (DataRow dr in dataTable.Rows)
                BuyBuilder u = new BuyBuilder();
                u.buylineid = ((long)dr["buylineid"]);
                u.cName = dr["cName"].ToString();
                u.cStation = dr["cStation"].ToString();
                u.cDemo = dr["cDemo"].ToString();
            return list;

Not sure how many records before it fails but i know it works for 2500 records and fails for 5000 records.  The grid just does not display the data once it returns more than 5000 records.  Please help. I also tried virtualization and that did not work as well.

2 Answers, 1 is accepted

Sort by
Telerik team
answered on 17 Jun 2014, 10:37 AM
Hello Xinzhou,

When you set ServerOperation to false, all data rows will be sent to the client with the first request. If they are too many, you will hit the JSON Serializer limit, which is not related to Kendo UI.

By the way, please do not confuse ServerOperation(false) with AutoBind(false). The comment below is not correct, as it applies to AutoBind(false).

.ServerOperation(false) //false = don't read on page load

Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Top achievements
Rank 1
answered on 17 Jun 2014, 01:30 PM
That's exactly it!!! Thanks for your help.

I must have put that comment in the wrong section as well. 
Asked by
Top achievements
Rank 1
Answers by
Telerik team
Top achievements
Rank 1
Share this question