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?
1.4m articles
1.4m replys
5 comments
57.0k users