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

Jak
Jak
Member
364 Points
152 Posts

Hi,

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

Views: 8219
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
1172 Points
211 Posts
         

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
 Log In to Chat