The definition of my extension method is this:
public static class HtmlHelperExtensions
{
public static Boolean MatchRoute(this HtmlHelper Html,
BaseViewModel Model,
String ControllerName,
params String[] ActionNames)
{
...
}
}
and this is how it’s being used inside my view
<li class="questions <% = Html.GetSelectedClass(Model, "questions", "viewquestion", "index") %>">
but for some strange reason when the method is called only the first of the 2 paremeters for ActionNames is passed to the method. What is going on?
No idea but this should work. What you have shown is in your view a call to
Html.GetSelectedClassand in your extension method is calledMatchRouteand returns boolean instead of string. Also if your views are strongly typed you don’t need to pass a model, you could do this:and then: