Hi,
I sent an email to support 2 days ago for this as I was told that emails are responded to within 24 hours. No reply. So trying on the forums now.
I have a grid that has columns dynamically created. It populates just fine.
When attempting to move to the next page or do a refresh, my browser asked me if I want to download or save read.json.
In my other grids with static columns (predefined), it works fine. It is just in this grid where the columns are dynamically created.
How do I fix this?
My View
My Controller
Please would someone respond ASAP. I am falling behind with my deadlines and need to get this sorted out ASAP.
TIA
I sent an email to support 2 days ago for this as I was told that emails are responded to within 24 hours. No reply. So trying on the forums now.
I have a grid that has columns dynamically created. It populates just fine.
When attempting to move to the next page or do a refresh, my browser asked me if I want to download or save read.json.
In my other grids with static columns (predefined), it works fine. It is just in this grid where the columns are dynamically created.
How do I fix this?
My View
@using Kendo.Mvc.UI
@model System.Data.DataTable
@{
Layout = null;
}
<!DOCTYPE html>
<
html
lang
=
"en"
>
<
head
>
<
meta
charset
=
"utf-8"
/>
<
title
>@ViewBag.Title</
title
>
<
link
href
=
"~/favicon.ico"
rel
=
"shortcut icon"
type
=
"image/x-icon"
/>
<
meta
name
=
"viewport"
content
=
"width=device-width"
/>
<
link
href
=
"@Url.Content("
~/Content/Site.css")"
rel
=
"stylesheet"
type
=
"text/css"
/>
<
link
href
=
"@Url.Content("
~/Content/kendo/2013.2.716/kendo.common.min.css")"
rel
=
"stylesheet"
type
=
"text/css"
/>
<
link
href
=
"@Url.Content("
~/Content/kendo/2013.2.716/kendo.dataviz.min.css")"
rel
=
"stylesheet"
type
=
"text/css"
/>
<
link
href
=
"@Url.Content("
~/Content/kendo/2013.2.716/kendo.blueopal.min.css")"
rel
=
"stylesheet"
type
=
"text/css"
/>
<
script
src
=
"@Url.Content("
~/Scripts/kendo/2013.2.716/jquery.min.js")"></
script
>
<
script
src
=
"@Url.Content("
~/Scripts/kendo/2013.2.716/kendo.all.min.js")"></
script
>
<
script
src
=
"@Url.Content("
~/Scripts/kendo/2013.2.716/kendo.aspnetmvc.min.js")"></
script
>
<
script
src
=
"@Url.Content("
~/Scripts/kendo.modernizr.custom.js")"></
script
>
</
head
>
<
body
style
=
"height: 100%"
>
<
div
id
=
"body"
>
@(Html.Kendo().Grid(Model)
.Name("Grid")
.Columns(columns =>
{
foreach (System.Data.DataColumn column in Model.Columns)
{
columns.Bound(column.ColumnName);
}
})
.Pageable(pager => pager.Refresh(true))
.DataSource(dataSource => dataSource
.Ajax()
.Model(model =>
{
foreach (System.Data.DataColumn column in Model.Columns)
{
model.Field(column.ColumnName, column.DataType);
}
})
.Read(read => read.Action("Read", "View", new { area = "DisplayPanel" }))
)
)
</
div
>
</
body
>
</
html
>
using System;
using System.Web.Mvc;
using Kendo.Mvc.Extensions;
using Kendo.Mvc.UI;
using Smartrail.Application;
using Smartrail.Common;
using Smartrail.Domain.Service.Contracts;
namespace SmartrailWeb.Areas.DisplayPanel.Controllers
{
public class ViewController : Controller
{
public ActionResult Index()
{
using (var uow = ApplicationContext.ServiceLocator.GetInstance<
IPresentationUnitOfWork
>())
{
var service = ApplicationContext.ServiceLocator.GetService<
IDisplayPanelCreatorService
>(uow);
return View(service.GetDataSet(new DateTime(1990, 1, 1), null));
}
}
[HttpGet]
public ActionResult Read([DataSourceRequest] DataSourceRequest request)
{
using (var uow = ApplicationContext.ServiceLocator.GetInstance<
IPresentationUnitOfWork
>())
{
var service = ApplicationContext.ServiceLocator.GetService<
IDisplayPanelCreatorService
>(uow);
return Json(service.GetDataSet(new DateTime(1990, 1, 1), null).ToDataSourceResult(request), JsonRequestBehavior.AllowGet);
}
}
}
}
TIA