iNerd Blog

Image link in ASP.NET MVC

Posted in Programming by Ari on 9 April 2010
<td>
    <%= Html.ActionLink("Edit", "Edit", new { id=item.Id  }) %> |
    <%= Html.ActionLink("Delete", "Delete", new { id=item.Id  }) %>
</td>

This is how a normal link usually written. When you want a url to be embedded within an image it should be written like this:

<td>
   <a href='<%= Url.Action("Edit", new {id=item.Id}) %>'>
       <img src="../../Content/Edit.png" alt="Edit" /></a>
</td>
<td>
   <a href='<%= Url.Action("Delete", new {id=item.Id}) %>'>
       <img src="../../Content/Delete.png" alt="Delete" /></a>

</td>


Advertisements
Tagged with:

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: