I am currently trying to get around IE6 / 7 error, which requires wrapping the closing tag </a>with this IE-specific comment, to make some sort of dropdown menu:
</a>
Unfortunately, I cannot insert this directly into my page code like this:
<%= Html.ActionLink("LinkName<!--[if IE 7]><!--></a><!--<![endif]-->","Action","Controller") %>
How Html.ActionLink will do the safe thing and filter out the comment to prevent a Javascript injection attack. Okay, cool. I'm fine with that. Good design decision.
What I would like to do is write an extension method for this, but this process eludes me since I have not done this before.
I thought this would work, but Intellisense doesn't seem to pick up this extension method that I wrote.
public static class MyLinkExtensions
{
public static string ActionLinkIE(this HtmlHelper htmlHelper,
string linkText, string actionName, string controllerName)
{
return LinkExtensions.ActionLink(htmlHelper, linkText, actionName, controllerName).
Replace(@"</a>", @"</a>");
}
}
Any suggestions?
: ? ( MyLinkExtensions)
, mousing <%= Html.ActionLink() %>, . ?