This question is locked. New answers and comments are not allowed.
Hi,
I'm using a telerik grid in a dynamic view.
Basically I have many different classes with the same field names but different behaviour, so i cannot strongly-type my view (Well i could create many different views but it's too much work) and i am using a dynamic view.
However I'm get the following error when I try to specity any of the columns in the grid:
Cannot use a lambda expression as an argument to a dynamically dispatched operation without first casting it to a delegate or expression tree type
I attach the code of my view:
Am I doing something wrong or is it impossible to do what i want with the telerik grid?
Thanks!
I'm using a telerik grid in a dynamic view.
Basically I have many different classes with the same field names but different behaviour, so i cannot strongly-type my view (Well i could create many different views but it's too much work) and i am using a dynamic view.
However I'm get the following error when I try to specity any of the columns in the grid:
Cannot use a lambda expression as an argument to a dynamically dispatched operation without first casting it to a delegate or expression tree type
I attach the code of my view:
@model dynamic@(Html.Telerik().Grid(Model.PensionPayment) .Name("PensionPaymentsGrid") .Localizable("en-GB") .DataKeys(keys => keys.Add(c => c.EntryID)) .ClientEvents(events => events.OnDataBound("onSA100MultipleTotalsGridBound").OnEdit("onEditPensionPayment")) .DataBinding(dataBinding => { dataBinding.Ajax() .Update("_AjaxInsertUpdateSA100GridData", "TaxForm", new { pobID = (int)ViewData["pobID"], dialogType = (string)ViewData["dialogType"] }) .Insert("_AjaxInsertUpdateSA100GridData", "TaxForm", new { pobID = (int)ViewData["pobID"], dialogType = (string)ViewData["dialogType"] }) .Delete("_AjaxDeleteSA100GridData", "TaxForm", new { pobID = (int)ViewData["pobID"], dialogType = (string)ViewData["dialogType"] }) .Select("_AjaxGetSA100GridData", "TaxForm", new { pobID = (int)ViewData["pobID"], dialogType = (string)ViewData["dialogType"] }); }) .ToolBar(commands => { commands.Insert().ButtonType(GridButtonType.Image); }) .Columns(columns => { columns.Bound(o => o.EntryID).Width(100).Hidden(); columns.Bound(o => o.ProviderName).Width(100); if ((string)ViewData["dialogType"] == "OverseasPensionPayments") { columns.Bound(o => o.Country).Width(100); } columns.Bound(o => o.ContractNumber).Width(100); if ((string)ViewData["dialogType"] == "PensionPayments") { columns.Bound(o => o.NetPayment).Width(100); } columns.Bound(o => o.GrossAmount).Width(100).Format("{0:c}"); columns.Command(commands => { commands.Delete().ButtonType(GridButtonType.Image); commands.Edit().ButtonType(GridButtonType.Image); }).Width(180).Title(""); }) .Editable(edit => edit.Mode(GridEditMode.InLine)) .Scrollable(scrolling => scrolling.Enabled(true)) .Sortable() .Selectable() .Pageable(paging => paging.Enabled(false)) .Filterable() .Footer(false)) <br />Am I doing something wrong or is it impossible to do what i want with the telerik grid?
Thanks!