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

Grid displays as Jason

2 Answers 64 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Eran
Top achievements
Rank 1
Eran asked on 23 Apr 2013, 07:02 AM
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/


[HttpGet]
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>

<h2>View1</h2>


@(Html.Kendo().Grid(Model)
.Name("CGrid")
.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");
})
//.Groupable()
.Pageable()
//.Sortable()
//.Filterable()
.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 Answers, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 24 Apr 2013, 02:22 PM
Hi,

 This would happen in the following cases:

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

Regards,
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!
0
Richard
Top achievements
Rank 1
answered on 08 Apr 2014, 09:48 AM
Can also fail if you have 2 grids on the page with the same name - that was my problem.
Tags
Grid
Asked by
Eran
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Richard
Top achievements
Rank 1
Share this question
or