I've been working on setting up some Ajax.ActionLinks in my project. I can get the ActionLinks working 100%, however, my problem comes when I want to use an image instead of text for the link.
I've used a couple other StackOverflow posts and came up with the following solution to show an image inside an ActionLink:
Ajax.ActionLink("[replacethis]", "_Edit", "Account", new { id = "<#= UserId#>" }, new AjaxOptions() { UpdateTargetId = "subForm", InsertionMode = InsertionMode.Replace, HttpMethod = "GET" }).ToHtmlString().Replace("[replacethis]", "<img src=\"" + Url.Content("~/Content/images/page-pencil-24.png") + "\" />"))
When I use a normal Ajax.ActionLink, my HTML looks like this:
<a href="/ct/administration/Account/_Edit/be71fdfc-0427-46e4-8ce5-6fa7cdf639d3" data-ajax-update="#subForm" data-ajax-mode="replace" data-ajax-method="GET" data-ajax="true">Edit</a>
When I use my new method my HTML looks like this:
<a href="/ct/administration/Account/_Edit/be71fdfc-0427-46e4-8ce5-6fa7cdf639d3" data-ajax-update="#subForm" data-ajax-mode="replace" data-ajax-method="GET" data-ajax="true">
<img src="/ct/Content/images/page-pencil-24.png">
</a>
When I put a break point in my controller and check if Request.IsAjaxRequest() == true, it's always False for the ImageActionLink, but True for the ActionLink.