As mentioned in comments, your image doesn't display when you aren't providing any text as your element is set to display as inline
. With no text, your element has no size, regardless of any width
or height
properties that are specified in the element's style. To fix this, set the element to display as inline-block
:
(Html.ActionLink(
"",
"ActionResult",
new {
CustomerId= DataBinder.Eval(c.DataItem, "CustomerId")
},
new {
target = "_blank",
@style = "
background-image:url(/Image/edit.png);
display:inline-block;
width:50px;
height:30px;
"
})
);