This is a migrated thread and some comments may be shown as answers.

[Solved] clienttemplate with <texr> problem

0 Answers 59 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
william
Top achievements
Rank 1
william asked on 28 Nov 2011, 12:03 PM
Hi all,

if I do the following then all works fine.

columns.Bound(r => r.RiskID)
                .ClientTemplate(
                    @Html.ActionLink("Edit", "Edit", "ProfessionalIndemnityRisk", new { riskID = "<#= RiskID #>" }, null).ToHtmlString() + " " +
                   @Html.Encode("<a class='deleteRisk' href='#' riskID='<#= RiskID #>', url='ProfessionalIndemnityRisk/DeleteRisk', gridName='risksGrid'>Delete</a>"))
this works because RiskID is on the Model as a datakey.

If I want to obtain a non key value at each level. THen if I do the following on an ActionLink code is still fine.
@<text>@Html.ActionLink("Edit", "Edit",@item.ControllerName, new  {                                                                                               {
sectionID = @item.SectionID,
policyZoneID = Model.PolicyZoneID
}, null) 
                            </text>

Notice to use @item I have had to wrap in a @<text>

This is where my problem now begins. for the @Html.Encode, I cannot use the same format How should I inject my item values into the encode?
Tags
Grid
Asked by
william
Top achievements
Rank 1
Share this question
or