create ajax actionlink with html elements in the link text

Viewed 11210

I would like to convert a link to an ajax action link. I can't figure out how to display html elements within the link text?

Here is the original link:

<a href="#onpageanchor" id="myId" class="myClass" title="My Title."><i class="icon"></i>Click Me</a>

Here is the ajax actionlink:

@Ajax.ActionLink("<i class='icon'></i>Click Me", "MyActionMethod", new { id = "testId" },
                        new AjaxOptions
                        {
                            UpdateTargetId = "mytargetid"
                        }, new
                        {
                            id = "myId",
                            @class = "myClass",
                            title="My Title."
                        })

the link text rendered is the actual string: "<i class='icon'></i>Click Me</a>"

3 Answers
Related