This question is locked. New answers and comments are not allowed.
I have a Master/Detail Client mode grid. The detail also has a detailTemplate to render some Html containing various action links.
I am using Databound expressions to supply the variable parts of the actionlink from the model. Some of the expression replacements are not working and it is not clear why. Examples of the same type of replacement are working in the master/detail grids but fail in the lowest DetailTemplate.
This is a simplified version of the code:
I am using Databound expressions to supply the variable parts of the actionlink from the model. Some of the expression replacements are not working and it is not clear why. Examples of the same type of replacement are working in the master/detail grids but fail in the lowest DetailTemplate.
This is a simplified version of the code:
@(Html.Telerik().Grid<AppraiseeListItemModel>() .Name("Appraisees") .DataKeys(keys => keys.Add(o => o.EmployeeId).RouteKey("id")) .DataBinding(dataBinding => dataBinding.Ajax() .Select("GetAppraiseesForManager", "Home")) .Columns(columns => { columns.Bound(c => c.Name).Title("Appraisee").Filterable(true).HeaderHtmlAttributes(new { @class = "FilterOnlyOn_Contains" }); }) .Filterable() .Sortable(sorting => sorting.Enabled(true)) .TableHtmlAttributes(new { style = "table-layout:fixed;" }) .Pageable(paging => paging.Enabled(true)) .DetailView(details => details.ClientTemplate( Html.Telerik().Grid<AppraisalListItemModel>() .Name("Appraisals_<#= EmployeeId #>") .DataKeys(keys => keys.Add(q => q.AppraisalId)) .DataBinding(dataBinding => dataBinding.Ajax() .Select("GetAppraisalsForEmployee", "Home", new { employeeId = "<#= EmployeeId #>" })) .Columns(columns => { columns.Bound(o => o.AppraiserName).Title("Appraiser(s)").Width(100); columns.Bound(o => o.Year).Title("Year").Width(5); columns.Bound(o => o.AppraisalId).Width(200).Title("Full") .ClientTemplate( "<# if (CanViewFullAppraisal) {#> " + Html.ActionLink("<#= FullAppraisalText #>", "<#= FullAppraisalAction #>", "Home", new { id = "<#= FullAppraisalActionId #>", year = Model.Year, isManager = true }, new { @class = "t-button" }).ToHtmlString() + "<# } #>"); }) .Pageable() .DetailView(d => d.ClientTemplate( "<fieldset style='border: thin #ccc; padding: 6px;'>" + Html.ActionLink("<#= DeferAppraisalText #>", "DeferAppraisal", "Home", new { id = "<#= ChangeAppraisalStatusId #>", deferReasonId = "dummyDeferReasonId" }, new { @id = "defer-link", @style = "<#= DeferAppraisalStyle #>", @class = "defer-appraisal-action t-button" }).ToHtmlString() + "</fieldset>")) .ToHtmlString()))).ClientTemplate( "<# if (CanViewFullAppraisal) {#> " + Html.ActionLink("<#= FullAppraisalText #>", "<#= FullAppraisalAction #>", "Home", new { id = "<#= FullAppraisalActionId #>", year = Model.Year, isManager = true }, new { @class = "t-button" }).ToHtmlString() + "<# } #>");
The above code in the nested Detail grid works. id = "<#= FullAppraisalActionId #>" the replacement for this works.
This does not work.
Html.ActionLink("<#= DeferAppraisalText #>", "DeferAppraisal", "Home", new { id = "<#= ChangeAppraisalStatusId #>", deferReasonId = "dummyDeferReasonId" }, new { @id = "defer-link", @style = "<#= DeferAppraisalStyle #>", @class = "defer-appraisal-action t-button" }).ToHtmlString()
This gets replaced ok: <#= DeferAppraisalText #>
but this renders without replacement (i.e. you get the expression code not its value replacement) new { id = "<#= ChangeAppraisalStatusId #>",
I have updated to the latest version of Telerik MVC just in case but that didnt resolve the issue.
John