Asp.net mvc 剑道UI中的客户端详细信息模板不工作
我在asp.NETMVC应用程序中有一个剑道网格。我跟随kendoui网站上的演示在我的网格上构建一个详细模板。我做不到。这是我的密码Asp.net mvc 剑道UI中的客户端详细信息模板不工作,asp.net-mvc,kendo-ui,kendo-grid,kendo-asp.net-mvc,Asp.net Mvc,Kendo Ui,Kendo Grid,Kendo Asp.net Mvc,我在asp.NETMVC应用程序中有一个剑道网格。我跟随kendoui网站上的演示在我的网格上构建一个详细模板。我做不到。这是我的密码 @(Html.Kendo().Grid<KendoUIMvcApplication2.Models.GetCallDetailResult>() .Name("Grid") .Columns(columns => { columns.Bound(p => p.contactCommunicationCallID).
@(Html.Kendo().Grid<KendoUIMvcApplication2.Models.GetCallDetailResult>()
.Name("Grid")
.Columns(columns =>
{
columns.Bound(p => p.contactCommunicationCallID).Title("CCCID").Width("20");
columns.Bound(p => p.LocalStartDateTime).Title("Date Time").Format("{0:M/d/yyyy}");
columns.Bound(p => p.LPEmployeeCode).Title("Employee Code").Width("50");
columns.Bound(p => p.AdSource).Title("Ad Source");
columns.Bound(p => p.Status);
columns.Bound(p => p.Duration).Title("Duration");
columns.Bound(p => p.TrackingPhoneNumber).Title("Tracking Number");
columns.Bound(p => p.CallerNumber).Title("Caller Number");
columns.Bound(p => p.RegionName).Title("Region Name");
columns.Bound(p => p.DistrictName).Title("District Name");
columns.Bound(p => p.CampaignName).Title("Campaign Name");
columns.Bound(p => p.AdSourceCategoryName).Title("Ad Source Category");
})
.Pageable(page => page.Enabled(true).PageSizes(new Int32[] { 5, 10, 20, 40 }))
.Sortable()
.HtmlAttributes(new { style = "height: 700px" })
.Scrollable()
.ClientDetailTemplateId("template")
.DataSource(datasource => datasource
.Ajax()
.PageSize(5)
.Read(read => read.Action("CallDetail", "Home"))
)
.Events(ev => ev.DataBound("dataBound"))
实际上,我通过反复试验发现,您只需要从web.config中删除httpRuntime中的targetFramework=xx部分—您可以保留encoderType部分 您的模型是否返回您在基诺模板中使用的所有属性?这些是区分大小写的。确保你拼写正确。是的。据我所知,代码是好的。但是我没有得到任何输出。当我在IE中调试时,它显示一个无效的模板异常和一个空的网格。通过删除@之间的网格代码开始故障排除,看看这是否能完美加载,然后你可以在iti中添加网格代码。我需要从web.config文件中删除这行代码。->成功了!我不知道为什么,但它做到了。但thx需要帮助。有关此问题的更多信息,请参阅。
<script>
function dataBound() {
this.expandRow(this.tbody.find("tr.k-master-row").first());
}
</script>
<script id="template" type="text/kendo-tmpl">
@(Html.Kendo().TabStrip()
.Name("tabStrip_#=contactCommunicationCallID#")
.SelectedIndex(0)
.Animation(animation => animation.Open(open => open.Fade(FadeDirection.In)))
.Items(items =>
{
items.Add().Text("Details").Content(@<text>
@(Html.Kendo().Grid<KendoUIMvcApplication2.Models.GetCallDetailResult>()
.Name("grid_#=contactCommunicationCallID#")
.Columns(columns =>
{
columns.Bound(p => p.contactCommunicationCallID).Title("ID").Width(56);
columns.Bound(p => p.SiteName).Width(110);
columns.Bound(p => p.LPFirstName);
columns.Bound(p => p.LPLastName).Width(190);
})
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(5)
.Read(read => read.Action("ReportList", "Home", new { CCCID = "#=contactCommunicationCallID#" }))
)
.Pageable()
.Sortable()
.ToClientTemplate()
)
</text>
);
items.Add().Text("Contact Information").Content(
"<div class='employee-details'>" +
"<ul>" +
"<li><label>Country:</label>#= contactCommunicationCallID #</li>" +
"<li><label>City:</label>#= SiteName #</li>" +
"<li><label>Address:</label>#= LPFirstName #</li>" +
"<li><label>Home Phone:</label>#= LPLastName #</li>" +
"</ul>" +
"</div>"
);
})
.ToClientTemplate())
</script>
<script>
function dataBound() {
this.expandRow(this.tbody.find("tr.k-master-row").first());
}
</script>
public ActionResult CallDetail([DataSourceRequest] DataSourceRequest request)
{
var readcalldetails = new DataDataContext().GetCallDetail(1, 762, 1).ToList();
var result = readcalldetails.ToDataSourceResult(request);
return Json(result);
}
public ActionResult ReportList(int CCCID, [DataSourceRequest] DataSourceRequest request)
{
var readreportlist = new DataDataContext().GetCallDetail(1, 762, 1).ToList().Where(cd => cd.contactCommunicationCallID == CCCID);
var result = readreportlist.ToDataSourceResult(request);
return Json(result);
//.Where(cd => cd.ContactCommunicationCallID == CCCID)
}