編譯器錯誤信息:CS1977:不能使用lambda表達式作爲參數傳遞給動態調度操作,而不首先將其強制轉換爲委託或表達式樹類型Telerik的MVC電網故障
我使用的程序存儲庫模式在這個項目,所以我通過服務調用的方式檢索到的數據,而不是常規的linq查詢。我不確定他們可能通過將爭論轉交給委託人或實證代表什麼。樹型。這裏是代碼。
@(Html.Telerik().Grid(Model)
.Name("Grid").Columns(columns =>
{
columns.Bound(o => o.formId).Width(100);
columns.Bound(o => o.Name).Width(200);
//columns.Bound(o => o.ShipAddress);
//columns.Bound(o => o.OrderDate).Format("{0:MM/dd/yyyy}").Width(120);
})
.DataBinding(dataBinding =>
{
dataBinding.Server().Select("Index", "Grid", new { ajax = ViewData["ajax"] });
dataBinding.Ajax().Select("_Index", "Grid").Enabled((bool)ViewData["ajax"]);
})
.Scrollable(scrolling => scrolling.Enabled((bool)ViewData["scrolling"]))
.Sortable(sorting => sorting.Enabled((bool)ViewData["sorting"]))
.Pageable(paging => paging.Enabled((bool)ViewData["paging"]))
.Filterable(filtering => filtering.Enabled((bool)ViewData["filtering"]))
.Groupable(grouping => grouping.Enabled((bool)ViewData["grouping"]))
.Footer((bool)ViewData["showFooter"])
)
public ActionResult Index(bool? ajax, bool? scrolling, bool? paging, bool? filtering, bool? sorting,
bool? grouping, bool? showFooter)
{
ViewData["ajax"] = ajax ?? true;
ViewData["scrolling"] = scrolling ?? true;
ViewData["paging"] = paging ?? true;
ViewData["filtering"] = filtering ?? true;
ViewData["grouping"] = grouping ?? true;
ViewData["sorting"] = sorting ?? true;
ViewData["showFooter"] = showFooter ?? true;
return View(formService.GetForms());
}
[GridAction]
public ActionResult _Index()
{
return View(new GridModel(formService.GetForms()));
}
這是我的疏忽,視圖的返回類型是Viewmodel的類型,而不是來自服務模型的模型。 – trevoirwilliams