I'm trying to create an Html Helper, by creating a static class as follows:
public static string Crumbs(this HtmlHelper helper, params string[] args) where T : class
{
// ... rest of code goes here.
}
And I'm invoking it like this:
<% Html.Crumbs(
Html.ActionLink("Home", "Index", "Home"),
Html.ActionLink("Lists", "Index", "User"),
Html.Encode(Model.List.Name)); %>
However, the view does not compile, as I get the following compilation error:
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?)
I don't get it. None of the documentation that I have mentions that you need to register the namespace of the static class anywhere. What am I doing wrong?