I have if condition and I want to disable or enable my actionLink button.
How would I do it?
@Html.ActionLink("Delete", "Delete", new { id = @Model.Id})
Thanks,
If you know on the server side that the link is not available then just render a message that the action is not available:
@if(condition) { @Html.ActionLink("Delete", "Delete", new { id = @Model.Id}) } else { <text>Action is not available</text> }
Otherwise you can only disable a link with
To make it work cross-browser: Should the HTML Anchor Tag Honor the Disabled Attribute?
2.1m questions
2.1m answers
60 comments
57.0k users