Razor 剑道网格,使用IE8时未正确填充数据库中的数据
我一直在尝试让剑道网格在IE8中正确填充(使用该程序的人被困在Windows XP中)。它在IE9、Firefox和Chrome中运行良好 这是我正在使用的代码 我的cshtml文件Razor 剑道网格,使用IE8时未正确填充数据库中的数据,razor,asp.net-mvc-4,internet-explorer-8,kendo-ui,kendo-grid,Razor,Asp.net Mvc 4,Internet Explorer 8,Kendo Ui,Kendo Grid,我一直在尝试让剑道网格在IE8中正确填充(使用该程序的人被困在Windows XP中)。它在IE9、Firefox和Chrome中运行良好 这是我正在使用的代码 我的cshtml文件 <!DOCTYPE html> @model IEnumerable<SymPro.ViewModels.InvestViewModel> @{ ViewBag.Title = "List Accounts"; } <p> @Html.ActionLink(
<!DOCTYPE html>
@model IEnumerable<SymPro.ViewModels.InvestViewModel>
@{
ViewBag.Title = "List Accounts";
}
<p>
@Html.ActionLink("Create New", "Create")
</p>
<font size ="1">
@(Html.Kendo().Grid<SymPro.ViewModels.InvestViewModel>()
.Name("gridInvest")
.Columns(columns =>
{
columns.Bound(p => p.asset_num).Title("Invest. <br/> No.");
columns.Bound(p => p.cusipnum).Title("Security <br/> ID").Width(80);
columns.Bound(p => p.rempar).Title("Remaining <br/> Par").Format("{0:0.00}").Width(100);
columns.Bound(p => p.issuer).Title("Issuer");
columns.Bound(p => p.purdate).Title("Purchased").Width(100);
columns.Bound(p => p.maturdate).Title("Mature/Sell").Width(100);
columns.Bound(p => p.invtype).Title("Type");
columns.Bound(p => p.fund_num).Title("Fund");
columns.Bound(p => p.nomrate).Title("Rate").Format("{0:0.00}");
columns.Bound(p => p.facevalue).Title("Par <br/> Value").Format("{0:0.00}");
columns.Bound(p => p.groupcd).Title("Group");
columns.Bound(p => p.sectorcd).Title("Sector");
columns.Bound(p => p.identity_column).Title("")
.ClientTemplate(@Html.ActionLink("Details", "Details", new { id = "#= identity_column#" }, new { style = "color:blue" })
.ToHtmlString()
);
columns.Bound(p => p.identity_column).Title("")
.ClientTemplate(@Html.ActionLink("Edit", "Edit", new { id = "#= identity_column#" }, new { style = "color:blue" })
.ToHtmlString()
);
columns.Bound(p => p.identity_column).Title("")
.ClientTemplate(@Html.ActionLink("Delete", "Delete", new { id = "#= identity_column#" }, new { style = "color:blue" })
.ToHtmlString()
);
})
.DataSource(dataSource => dataSource
.Ajax()
.Read(read => read.Action("Invest_Read", "Invest"))
)
.Sortable()
.Scrollable(scr=>scr.Height(450))
)
</font>
请检查使用浏览器开发工具生成的html。我认为IE8不支持html5,剑道网格可能正在使用自定义属性,如数据xxxx。请确保您已按照将kendo.aspnetmvc.js文件添加到布局页面的说明进行操作。同样,这个问题也可能会派上用场。我解决了我的问题。在我的视图模型InvestViewModel中,我有一个名为@class的变量,该变量在程序的其他地方使用,但是当它被传递到网格时,这在剑道中引起了一个问题,即使它是空的。您不需要一些etc.标记吗?我不知道这是否有助于解决您的问题,但它会让我感觉更快乐。该文件位于我的_布局文件中。我知道它正在工作,因为我正在使用剑道网格和应用程序上的其他页面,这些页面正在按预期工作。
public ActionResult Invest_Read([DataSourceRequest]DataSourceRequest request)
{
decimal initzero = 0000000000000.00M;
string initcode = "";
string DefPublCd = "";
var dbAgencyQuery = (from d in db.dbagency
select d).FirstOrDefault();
if (dbAgencyQuery != null)
{
DefPublCd = dbAgencyQuery.defpublcd;
}
DateTime general = new DateTime(1900, 1, 1);
DateTime? empty = null;
var accounts = (from i in db.invest
join s in db.dbsumcalcs on i.asset_num equals s.asset_num into i_s
from subi_s in i_s.DefaultIfEmpty()
join f in db.fisectasgn on i.ficspkey equals f.cspkey into i_f
from subi_f in i_f.DefaultIfEmpty()
join e in db.sector on subi_f.syseckey equals e.syseckey into f_e
from subf_e in f_e.DefaultIfEmpty()
where subf_e.publcd == DefPublCd
orderby i.maturdate
select new InvestViewModel
{
asset_num = i.asset_num,
cusipnum = i.cusipnum,
rempar = (subi_s == null ? initzero : subi_s.rempar),
issuer = i.issuer,
purdate = (i.maturdate == general || i.maturdate == DateTime.MinValue ? empty : i.purdate),
maturdate = (i.maturdate == general || i.maturdate == DateTime.MinValue ? empty : i.maturdate),
invtype = i.invtype,
fund_num = i.fund_num,
nomrate = i.nomrate,
facevalue = i.facevalue,
creditcode = (subi_s == null ? initcode : subi_s.creditcode),
credrte2 = (subi_s == null ? initcode : subi_s.credrte2),
groupcd = (subf_e == null ? initcode : subf_e.groupcd),
sectorcd = (subf_e == null ? initcode : subf_e.sectorcd),
identity_column = i.identity_column
});
DataSourceResult result = accounts.ToDataSourceResult(request);
return Json(result, JsonRequestBehavior.AllowGet);
}