开发者

add new actionlink extension

From what I can see, there are various extension methods for HtmlHelper. There is a class called LinkExtensions that holds various extension methods related to links. I want to add an additio开发者_如何学Gonal ActionLink extension that has a different number of parameters (so another overriden method called ActionLink). How do I go about doing this?

So far I have done this, and it does not work (doesn't appear as an extension method):

public static class ActionLinkExtensions
{
    public static MvcHtmlString ActionLink(this HtmlHelper helper, String linkText, int someNumber, String actionName, String controllerName, Object routeValues, Object htmlAttributes)
    {
        return helper.ActionLink(linkText, actionName, controllerName, routeValues, htmlAttributes);
    }
}


Be sure to include the namespace in which your extension method is defined. E.g:

using Whatever.Namespace.You.Used;
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜