0

我创建了这个自定义操作链接

public static IHtmlString CustomActionLink(this HtmlHelper htmlHelper, int userId, string controller, string linkText, string action)
    {
        int userID = userId;
        bool isAllowed = checkPermission(userID,action,controller);
        if (isAllowed == false)
        {
            return MvcHtmlString.Empty;
        }
        return htmlHelper.ActionLink(linkText, action);
    }

我尝试将此方法称为 Helper.CustomActionLink(4,"myController","text","MyAction") 但它要求我也传递第一个参数 'this HtmlHelper htmlHelper' 我如何解决这个问题

4

1 回答 1

2

你应该这样称呼它:

@Html.CustomActionLink(4,"myController","text","MyAction")
于 2012-06-26T07:28:22.843 回答