What is the best way to replace links with images using Razor in MVC3. I simply doing this at the moment:
<a href="@Url.Action("Edit", new { id=MyId })"><img src="../../Content/Images/Image.bmp", alt="Edit" /></a>
Is there a better way?
actionasp.net-mvc-3imagerazor
What is the best way to replace links with images using Razor in MVC3. I simply doing this at the moment:
<a href="@Url.Action("Edit", new { id=MyId })"><img src="../../Content/Images/Image.bmp", alt="Edit" /></a>
Is there a better way?
Best Answer
You can create an extension method for HtmlHelper to simplify the code in your CSHTML file. You could replace your tags with a method like this:
Here is a sample extension method for the code above: