我在DB中有一对多关系(我使用实体接口生成2 obj之间的关联)我得到错误:绑定列需要字段或属性访问表达式
我的代码:
在视图中:
Html.Telerik()
.Grid<Y.Orders.Models.Orders>("orders")
.Name("Orders")
.DataKeys(dataKeys => dataKeys.Add(o => o.Id))
//.Pageable(paging => paging.PageSize(20).Style(GridPagerStyles.PageSizeDropDown | GridPagerStyles.NextPreviousAndNumeric))
.Columns(columns =>
{
columns.Command(commands =>
{
commands.Custom("comments").ButtonType(GridButtonType.Text).Text("Szczegó?y").Action("Index", "Komentarze");
});
columns.Bound(o => o.Tytul).Title("Title");
columns.Bound(o => o.Deliveries.Sum(m=>m.deliveryTime)).Title("Time of order");
})
.Filterable()
.Sortable(sort =>
{
sort.SortMode(GridSortMode.MultipleColumn); sort.OrderBy(ord =>
{
ord.Add(o => o.Time).Descending();
});
})
.Groupable(grouping => grouping.Groups(groups =>
{
groups.Add(c => c.Users.Firms.Name);
}))
.Render();
Run Code Online (Sandbox Code Playgroud)
在实体模型中:
public ObjectSet<Deliveries> Deliveries
{
get
{
if ((_ Deliveries
== null))
{
_Deliveries = base.CreateObjectSet<Deliveries>("Deliveries");
}
return _Deliveries;
}
}
private …Run Code Online (Sandbox Code Playgroud)