Kendo grid paging throwing an java script error kendo.aspnetmvc.min.js file -
i working on kendo grid. have implemented ajax binding default paging.
in ie10 getting javascript error in aspnetmvc.min.js file before pageload. once page loaded working perfectly.
below code have used
.cshtml -------- <div> @(html.kendo().grid<kendouiajaxbinding.model.pm_ano>() .name("grid") .datasource(datasource => datasource .ajax() .read(read => read.action("products_read", "home") .data("productsreaddata") ) ) .columns(columns => { columns.bound(anomaly => anomaly.god); columns.bound(anomaly => anomaly.ver); // create column bound productid property columns.bound(anomaly => anomaly.c_ano); // create column bound productname property columns.bound(anomaly => anomaly.y_ano); // create column bound unitsinstock property columns.bound(anomaly => anomaly.z_rep_auto); }) .pageable(x => x.pagesizes(true)) // enable paging .sortable() // enable sorting ) </div> in layout page have rendered ---------------------------------------- <head> <meta charset="utf-8" /> <title>@viewbag.title - asp.net mvc application</title> <link href="~/favicon.ico" rel="shortcut icon" type="image/x-icon" /> <meta name="viewport" content="width=device-width" /> <script src="~/scripts/jquery-1.7.1.js"></script> <script src="~/scripts/kendo/kendo.web.min.js"></script> <script src="~/scripts/kendo/kendo.aspnetmvc.min.js"></script> </head> controller code ------------------ public jsonresult products_read([datasourcerequest]datasourcerequest request, string firstname, string lastname) { var _context = new e2a_guientities(); iqueryable<pm_ano> anomaly = _context.pm_ano; var total = anomaly.count(); if (request.page > 0) { anomaly = anomaly.orderby(a => a.c_ano).skip((request.page - 1) * request.pagesize); } anomaly = anomaly.take(request.pagesize); var result = new datasourceresult() { data = anomaly, // process data (paging , sorting applied) total = total // total number of records }; return json(result, jsonrequestbehavior.allowget); }
please me in resolving problem.
thanks in advance.
thanks , regards, gangadhar
try this:
public jsonresult products_read([datasourcerequest]datasourcerequest request, string firstname, string lastname) { var _context = new e2a_guientities(); iqueryable<pm_ano> anomaly = _context.pm_ano; //do other logic here. // eg anomaly = anomaly.orderby(o => o.c_ano).where(w => w.d_ano.contains(firstname); return json(anomaly.todatasourceresult(request, modelstate), jsonrequestbehavior.allowget); }
just make sure have following using statement included:
using kendo.mvc.extensions;
the todatasourceresult extension method grid taking, paging, sorting, filtering , selection you.
edit:
these files include part of kendo project
<link href="@url.content("~/content/kendo/2014.1.624/kendo.common.min.css")" rel="stylesheet" type="text/css" /> <link href="@url.content("~/content/kendo/2014.1.624/kendo.dataviz.min.css")" rel="stylesheet" type="text/css" /> <link href="@url.content("~/content/kendo/2014.1.624/kendo.bootstrap.min.css")" rel="stylesheet" type="text/css" /> <link href="@url.content("~/content/kendo/2014.1.624/kendo.dataviz.bootstrap.min.css")" rel="stylesheet" type="text/css" /> <script src="@url.content("~/scripts/kendo/2014.1.624/jquery.min.js")"></script> <script src="@url.content("~/scripts/kendo/2014.1.624/kendo.all.min.js")"></script> <script src="@url.content("~/scripts/kendo/2014.1.624/kendo.aspnetmvc.min.js")"></script> <script src="@url.content("~/scripts/kendo.modernizr.custom.js")"></script> <script src="@url.content("~/scripts/kendo/2014.1.624/cultures/kendo.culture.en-gb.min.js")"></script>
obviously change 2014.1.624 version using or file path match project.
Comments
Post a Comment