I have inside a view file something like
@Html.ActionLink("Details", "Details", new { id=item.RuleId }) |
@Html.ActionLink("Edit", "Edit", new { id = item.RuleId }) |
@Html.ActionLink("Delete", "Delete", new { id = item.RuleId })
and this works, but when I change it to something like
@Html.ActionLink("Details", "Details", new { id=item.RuleId }) |
@if( something )
{
Html.ActionLink("Edit", "Edit", new { id = item.RuleId });
Html.ActionLink("Delete", "Delete", new { id = item.RuleId });
}
it stops displaying the second and third items ( although is entering the branch ) .
Any ideas why ?
Html.ActionLink returns an IHtmlString object containing an <a> tag.
It doesn't do anything by itself.
Your code is ignoring this result, so nothing happens.
You need to print the result to the page using the @ character.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With