Reputation: 843
I want to create a group of Actionlink and have control on that. Like
Add | Edit | Delete
I tried it as
grid.Column(header: "Payload Actions", format: @<text> @if (item.Status == "ERROR") { @Html.ActionLink("Add", "Add", "THRecovery", new {item.id}, new {@class = "addAction", @style = "color:blue;"}) | @Html.ActionLink("Detail", "Detail", "THRecovery", new {item.id}, new {@class = "detailAction", @style = "color:blue;"}) | @Html.ActionLink("Delete", "Delete", "THRecovery", new { item.id }, new { @class = "deleteAction", @style = "color:blue;" }) } @if (item.Status != "ERROR") { @Html.ActionLink("Details", "Details", "THRecovery", new {item.id}, new {@class = "detailAction", @style = "color:blue;"}) } </text> )
I added "|" at the end of ActionLink but it is giving me error - Unexpected Token.
If status = ERROR then I want to display as Add | Detail | Delete if not then only Detail
Please suggest me how to do this.
Upvotes: 0
Views: 620
Reputation: 651
It will work if you put '|' inside a <text>
tag.
Like this:
<text>|</text>
Exemple with your code:
@Html.ActionLink("Add", "Add", "THRecovery", new {item.id}, new {@class = "addAction", @style = "color:blue;"}) <text>|</text>
You can use @:|
too. This way the pipe character will be read as server code and will print the '|' character without any problems.
Upvotes: 1