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

Jak
Jak
Member
858 Points
132 Posts

Hi,

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

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

Share:   fb twitter linkedin
Answers
Rahul Maurya
Rahul M...
Teacher
4822 Points
23 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