This question is locked. New answers and comments are not allowed.
Hi All,
I have the following code Where Covers is a complex type on my view.
When the grid attempts to load it errors on the detail bound column with : Bound columns require a field or property access expression. If I replace the binding with a non complex column such that I map :
I have the following code Where Covers is a complex type on my view.
@(Html.Telerik().Grid<GRID.ViewModels.ComputerBreakdownRiskViewModel>() .Name("risksGrid") .Sortable() .DataKeys(keys => keys.Add(r => r.ComputerBreakdownRiskID)) .ToolBar(commands => commands.Custom().ButtonType(GridButtonType.ImageAndText).Text("Add New Risk").HtmlAttributes(new { @class = "addRisk" }).Action("Create", "ComputerBreakdownRisk", new { policyZoneID = ViewData["policyZoneID"], sectionID = ViewData["sectionID"] })) .DataBinding(dataBinding => { dataBinding.Ajax() .Select("_RisksIndex", "ComputerBreakdownSection", new { policyZoneID = ViewData["policyZoneID"], sectionID = ViewData["sectionID"] }); }) .Columns(columns => { columns.Bound(r => r.ComputerBreakdownRiskID).Title("Edit") .Template(r => @Html.ActionLink("Edit", "Edit", "ComputerBreakdownRisk", new { riskID = r.ComputerBreakdownRiskID, policyZoneID = ViewData["policyZoneID"], sectionID = ViewData["sectionID"] }, new { @class = "editLink" })); columns.Bound(r => r.ComputerBreakdownRiskID).Title("Delete") .Template(r => @Html.ActionLink("Delete", "Delete", "ComputerBreakdownRisk", new { riskID = r.ComputerBreakdownRiskID, policyZoneID = ViewData["policyZoneID"], sectionID = ViewData["sectionID"] }, new { @class = "deleteLink" })); columns.Bound(r => r.Description).Width(200); columns.Bound(r => r.IndemnityPeriod).Width(50); columns.Bound(r => r.ManuallyRated); }) .RowAction(row => { if (row.IsAlternate) { row.HtmlAttributes["style"] = "background:aliceblue;"; } }) .ClientEvents(events => events.OnRowDataBound("covers_onRowDataBound")) .DetailView(detailView => detailView.ClientTemplate( Html.Telerik().Grid<GRID.ViewModels.ComputerBreakdownRiskViewModel>() .Name("detailview_<#= ComputerBreakdownRiskID #>") .Columns(columns => { columns.Bound(co => co.Covers.Select(m => m.Name)); }) .DataBinding(dataBinding => { dataBinding.Ajax() .Select("_CoverDetailForRiskHierarchyAjax", "ComputerBreakdownRisk", new { riskID = "<#= ComputerBreakdownRiskID #>" }); }) .ToHtmlString() )) )When the grid attempts to load it errors on the detail bound column with : Bound columns require a field or property access expression. If I replace the binding with a non complex column such that I map :
columns.Bound(co => co.Description);then I get no complaint, My Master data displays, but the Description on my detail is empty. in all cases, my _coverDetailForRiskHierearchyAjax method seems not to get fired. So how does the detail bind to the master on initial load? If it was binding I would expect to at least see the description even though I really want an enumeration of my complex type