Html.ActionLink as a button or an image, not a link

Jak
Jak
Member
352 Points
151 Posts

Hi,

Html.ActionLink as a button or an image, not a link

Views: 8156
Total Answered: 1
Total Marked As Answer: 1
Posted On: 08-Jan-2015 17:16

Share:   fb twitter linkedin
Answers
Rahul Maurya
Rahul M...
Moderator
1170 Points
210 Posts
Marked as answer      

You could just keep it simple and apply a CSS class to the htmlAttributes object:

<%= Html.ActionLink("Button Name", "Index", null, new { @class="classname" }) %>

and then create a class in your stylesheet

a.classname { background: url(../Images/image.gif) no-repeat top left; display: block; width: 150px; height: 150px; text-indent: -9999px; /* hides the link text */ }
Posted On: 08-Jan-2015 17:23
banner

Blog

Active User (2)

 Log In to Chat