<div class="orderby_name">
@Html.ActionLink(" ", "DisplayCategory", "Categories", new { articleSortBy = "Name", articleSortType = "asc" }, null)
</div>
i am lookin in razor if exist ImageLink. Now i have @Html.ActionLink and becouse i do not have any text name i can not click on it. I want to have image as link.
How can i make image as link in razor?
ActionLink(HtmlHelper, String, String, String, String, String, String, Object, Object) Returns an anchor element (a element) for the specified link text, action, controller, protocol, host name, URL fragment, route values, and HTML attributes.
There is a difference. Html. ActionLink generates an <a href=".."></a> tag whereas Url. Action returns only an url.
ActionLink is rendered as an HTML Anchor Tag (HyperLink) and hence it produces a GET request to the Controller's Action method which cannot be used to send Model data (object). Hence in order to pass (send) Model data (object) from View to Controller using @Html.
The built-in helper cannot do that.
You need to create an ordinary <a href="@Url.Action(...)">
tag.
Hope this code is helpful
@using (Html.BeginForm())
{
<a href='@Url.Action("Index")'>
<img src='@Url.Content("../../Content/Images/head.jpg")' alt="Home Page">
</a> }
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