1

I need to have an image instead of clickable text and using MVC helpers. Trying the following in vain, also tried toying with MvcHtmlString.Create() which gives an error:

                        @Ajax.ActionLink(Url.Content("~/Content/extremepc/rightarrow.png"), "Index", "Store", new { category = Model.category, page = Model.PagingInfo.CurrentPage + 1 }, 
               new AjaxOptions
   {
       UpdateTargetId = "Everything",

       Url = Url.Action("StoreContent", "Store", new { category = Model.category, page = Model.PagingInfo.CurrentPage + 1 })
   })
LaserBeak
  • 3,257
  • 10
  • 43
  • 73

1 Answers1

1

Unfortunately, you have to render the link manually.
This might require a lot of effort with your Ajax helper methods, so you'd be best to wrap it in an AjaxHelper Extension method.

See this very similar question for several similar solutions: Html.ActionLink as a button or an image, not a link

It would be awesome if the Html.ActionLink (and all other helpers for that matter) would allow the label parameter to accept a HtmlString ... I'm actually surprised that's not already the case!
However, since the MVC framework is open-source, it actually wouldn't be too difficult to copy the AjaxHelper methods, and modify them to use HtmlString instead of String.

Community
  • 1
  • 1
Scott Rippey
  • 15,614
  • 5
  • 70
  • 85