我创建了这个自定义动作链接
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的#34;"文本"" MyAction&#34) 但是它要求我传递第一个论点'这个HtmlHelper htmlHelper'我如何解决这个问题
答案 0 :(得分:2)
您应该这样称呼它:
@Html.CustomActionLink(4,"myController","text","MyAction")