나는 다음과 같이 정적 클래스를 작성하여,하는 HTML 도우미를 만들려고 해요 :HtmlHelper가 누락 되었습니까?
public static string Crumbs(this HtmlHelper helper, params string[] args) where T : class
{
// ... rest of code goes here.
}
을 그리고 나는 이런 식으로 호출 해요 : 그러나
<% Html.Crumbs(
Html.ActionLink("Home", "Index", "Home"),
Html.ActionLink("Lists", "Index", "User"),
Html.Encode(Model.List.Name)); %>
, 뷰가 컴파일되지 않습니다 , 다음과 같은 컴파일 오류가 발생합니다.
CS1061: 'System.Web.Mvc.HtmlHelper' does not contain a definition for 'Crumbs' and no extension method 'Crumbs' accepting a first argument of type 'System.Web.Mvc.HtmlHelper' could be found (are you missing a using directive or an assembly reference?)
나는 알 수 없습니다. 정적 클래스의 네임 스페이스를 어디에서나 등록해야한다는 언급이없는 설명서는 없습니다. 내가 도대체 뭘 잘못하고있는 겁니까?
좋아! 나는 네가 두 가지 가능한 방법을 지적했다는 사실을 좋아한다. –