0

私はこのカスタムアクションを作成しますlink

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 に答える