0

this is action links code in mvc 5. I need to add images instead of text. how to do it

@Html.Raw("<a onclick='MergeCustomer(" + item.customer_id + ", " +
           TempData["NewCustomerID"] + ")'>Merge</a>") 
    <span style=" color:black">|</span>
    @Ajax.ActionLink("Compare", "_CompareCustomerDetails", 
    new { ExistingCustomerId = item.customer_id, NewCustomerId = TempData["NewCustomerID"]},
    new AjaxOptions()
     {
       HttpMethod = "Get",
       UpdateTargetId =divCustomerCompare",
       InsertionMode = InsertionMode.Replace
      }, new { id = "lnkCompare"})}
Tommy
  • 39,592
  • 10
  • 90
  • 121
aadi k
  • 11
  • 8
  • possible duplicate of [ASP.NET MVC Ajax.ActionLink with Image](http://stackoverflow.com/questions/341649/asp-net-mvc-ajax-actionlink-with-image) – GSerg Dec 01 '14 at 17:16

1 Answers1

0

You can't. @Html.ActionLink only works on text.

In this instance your best bet is to use the @Url.Action() helper method, like so:

<a href="@Url.Action("Compare", "_CompareCustomerDetails")"><img src="yourimage.jpg"/></a>

Joseph Woodward
  • 9,191
  • 5
  • 44
  • 63