I have two questions about creating custom HTML helpers.
1) Where should my method be located so that it can be used with @Html? I figured out how to use it with something like @MyCustomClass. Anyway, I will work. Just curious.
2) More importantly, what is the "HtmlHelper htmlHelper"? I notice that all built-in helpers, such as ActionLink, for example, start with this parameter, but then no value is passed to it. BUT ... when I try to create my own HTML helper, it seems to me that I need a value for this parameter or it gives me: "The best overload method contains more than x parameters."
I am trying to implement this example :
public static string IsSelected(this HtmlHelper html, string controllers = "", string actions = "", string cssClass = "selected")
{
...
}
source
share