Grid displays as Jason

3 posts, 0 answers
  1. Eran
    Eran avatar
    4 posts
    Member since:
    Apr 2013

    Posted 23 Apr 2013 Link to this post

    trying to initialize my Kendo ui grid. I am able to populate it using the View object, but when I try doing it in Json format (i.e. when moving to next page) I get a screen showing json results instead of my view.Here's the controller code: public class CampaignsController : Controller
    // GET: /Campaigns/

    public ActionResult Index()
    return View(GetAllCampaigns());

    public ActionResult Campaigns_Read([DataSourceRequest] DataSourceRequest request)
    DataSourceResult result = GetAllCampaigns().ToDataSourceResult(request);
    return Json(result, JsonRequestBehavior.AllowGet);

    private static IEnumerable<NH_Campaign> GetAllCampaigns()
    List<NH_Campaign> result = null;
    if (MBPDataAccess.Instance.GetAll(out result))
    return result;
    return new List<NH_Campaign>();
    }and the cshtml is :@model IEnumerable<MBP.NH_Campaign>


    .Columns(columns =>
    columns.Bound(p => p.CampaignID).Title("Id");
    columns.Bound(p => p.CampaignName).Title("Name");
    columns.Bound(p => p.ClickUrlC2C_OFF).Title("Click URL");
    columns.Bound(p => p.PlatformID).Title("Platform ID");
    .DataSource(dataSource => dataSource.Ajax().PageSize(2).Read(read => read.Action("Campaigns_Read", "Campaigns"))
    ));the Index action that is called when the page is loaded works great, but when I try to move to the next page the Camapigns_Read action is called but I get a blank page with json results.
     i want to perform paging on server-side
    What am I missing here? 
  2. Atanas Korchev
    Atanas Korchev avatar
    8462 posts

    Posted 24 Apr 2013 Link to this post


     This would happen in the following cases:

     - The required Kendo UI JavaScript files are not included
     - There is a JavaScript error in the page

    Atanas Korchev
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  3. Richard
    Richard  avatar
    5 posts
    Member since:
    Mar 2014

    Posted 08 Apr 2014 Link to this post

    Can also fail if you have 2 grids on the page with the same name - that was my problem.
Back to Top