I'm using MVC3 with Razor. I have the following helper:
public static class ImageActionLinkHelper
{
public static string ImageActionLink(this AjaxHelper helper, string imageUrl, string actionName, object routeValues, AjaxOptions ajaxOptions)
{
var builder = new TagBuilder("img");
builder.MergeAttribute("src", imageUrl);
builder.MergeAttribute("alt", "");
var link = helper.ActionLink(builder.ToString(TagRenderMode.SelfClosing), actionName, routeValues, ajaxOptions);
return link.ToHtmlString();
}
}
and in my view I have:
@Ajax.ImageActionLink("../../Content/Images/button_add.png", "JobTasksNew", "TrackMyJob",new AjaxOptions { HttpMethod = "GET", UpdateTargetId = "tmjDynamic" }))
and this is what i get when the page gets rendered
<a data-ajax="true" data-ajax-method="GET" data-ajax-mode="replace" data-ajax-update="#tmjDynamic" href="/TrackMyJob/JobTasksNew?Length=10">&amp;lt;img alt=&amp;quot;&amp;quot; src=&amp;quot;../../Content/Images/button_add.png&amp;quot;&amp;gt;&amp;lt;/img&amp;gt;</a>
Microsoft has an example with ajax.actionlink.Replace but I don't have this method. Can you help me get the correct html string?
Thank you in advance.