grid.Column(format:
v =>
@Html.ActionLink(@item.Name, "Details", new { id = item.Id }).ToString() +
(v.State == State.Y
? @Html.ActionLink("Start", "Start", new { id = v.Id })
: (v.State == State.Z)
? @Html.ActionLink("Continue", "Start", new { id = v.Id })
: MvcHtmlString.Create("")).ToString()
)
This solution gives me a encoded HTML, What can I Do Instead?
This answer is based upon the SO Question found here
The idea is to use tags to allow Razor markup and content to be mixed.
Sample:
<text>
@Html.ActionLink("Edit", "Edit", new { id = item.Id }) |
@Html.ActionLink("Details", "Details", new { id = item.Id })
@if(item.State == State.Y)
{
@: | @Html.ActionLink("Continue", "Start", new { id = item.Id })
}
</text>