hello
I have following Index view in index.cshtml
and in Repost controller I have following method
When I run the application, it shows Json data directly as follows but not in Index view's grid. What is going wrong?
I have following Index view in index.cshtml
@{ ViewBag.Title = "Repost";}<script src="../../Scripts/Kendo/kendo.web.min.js" type="text/javascript"></script><script src="../../Scripts/Kendo/console.js" type="text/javascript"></script><script src="../../Scripts/Kendo/jquery.min.js" type="text/javascript"></script><link href="../../Content/Kendo/kendo.common.min.css" rel="stylesheet" type="text/css" /><link href="../../Content/Kendo/kendo.default.min.css" rel="stylesheet" type="text/css" /><h2>Repost</h2><div id="grid"></div><script type="text/javascript"> $(document).ready(function () { debugger; var dataSource = new kendo.data.DataSource({ transport: { read: { url: "Repost/Index", dataType: "json", type: "POST" } }, schema: { data: "reposts" } }); $("#grid").kendoGrid({ dataSource: dataSource, autobind: true, columns: [ { title: "SR NO", field: "SR_NO" }, { title: "MEMBER ID", field: "MEMBER_ID" }, { title: "MONTH", field: "R_MONTH" }, { title: "PRINT Y/N?", field: "PRINT_YN" } ], height: 360, groupable: false, sortable: false, pageable: false, scrollable: false }); }); </script>and in Repost controller I have following method
public class RepostController : Controller { public JsonResult Index() { DadavaniContext context = new DadavaniContext(); var result = context.Reposts.OrderByDescending(r => r.SR_NO).ToList(); var allReposts = from c in result select new[] { Convert.ToString(c.SR_NO), c.MEMBER_ID, c.R_MONTH, c.PRINT_YN }; return Json(new { reposts = allReposts }, JsonRequestBehavior.AllowGet); } }When I run the application, it shows Json data directly as follows but not in Index view's grid. What is going wrong?