私は同じ問題に取り組んでいましたが、Ajax ボタンを作成していたため、ヘルパーを使い続けたいと考えていました。
最終的に、ヘルパーごとに 1 つずつ、次の 2 つのヘルパー メソッドが作成されました。
public static MvcHtmlString IconActionLink(this AjaxHelper helper, string icon, string text, string actionName, string controllerName, object routeValues, AjaxOptions ajaxOptions, object htmlAttributes)
{
var builder = new TagBuilder("i");
builder.MergeAttribute("class", icon);
var link = helper.ActionLink("[replaceme] " + text, actionName, controllerName, routeValues, ajaxOptions, htmlAttributes).ToHtmlString();
return new MvcHtmlString(link.Replace("[replaceme]", builder.ToString()));
}
public static MvcHtmlString IconActionLink(this HtmlHelper helper, string icon, string text, string actionName, string controllerName, object routeValues, object htmlAttributes)
{
var builder = new TagBuilder("i");
builder.MergeAttribute("class", icon);
var link = helper.ActionLink("[replaceme] " + text, actionName, controllerName, routeValues, htmlAttributes).ToHtmlString();
return new MvcHtmlString(link.Replace("[replaceme]", builder.ToString()));
}
プロジェクトの静的クラスにそれらを投げてコンパイルすると、それらが表示されるはずです (ページに using ステートメントを追加する必要がある場合があります)。
ヘルパーを使用する場合、アイコン文字列に「icon-plus」または「icon-plus icon-white」を使用できます。