user2927086
user2927086

Reputation: 101

Set image to Html ActionLink

Html.ActionLink("Edit", "ActionResult", new { CustomerId= DataBinder.Eval(c.DataItem, "CustomerId") }, new { target = "_blank" })

How can i make html.actionlink as image (set image)

Any help will be greatly apreciated.

Upvotes: 0

Views: 341

Answers (1)

David
David

Reputation: 219107

An ActionLink is, pretty much by definition, a link. The Html.ActionLink method you're calling even accepts the text of the link as its first parameter, so you can expect it to be a text link.

But with slightly more manual HTML, you can create an a tag around an img tag using the same target URL. Just use Url.Action instead of Html.ActionLink. Maybe something like this:

<a href="@Url.Action("ActionName", "ControllerName", new { CustomerId= DataBinder.Eval(c.DataItem, "CustomerId") })" target="_blank">
    <img src="yourImage.png" alt="Image Text" />
</a>

Upvotes: 1

Related Questions