I have a default route specified like this:
routes.MapRoute(
"Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
new { controller = "Home", action = "Index", id = "", RouteName = "Default" }, // Parameter defaults
new { controller = @"[^\.]*" } // Constraints (Ignore urls with periods in them)
);
I have a controller called Test and an action on Test called DoSomething that is defined like this:
public ActionResult DoSomething(int someId, int someotherId, IEnumerable<string> listOfSomething, bool flag, bool flag2)
I am trying to call the action like this:
var parameters = new RouteValueDictionary();
parameters.Add("someId", id);
parameters.Add("someotherId", otherId);
parameters.Add("flag", flag1);
parameters.Add("flag2", flag2);
for (int i = 0; i < thisList.Count; i++)
{
parameters.Add("listOfSomething[" + i + "]", thisList[i]);
}
Html.RenderAction("DoSomething", "Test", parameters);
The Html.RenderAction call is failing with the InvalidOperationException : No route in the route table matches the supplied values.
What would be causing this? The default route should pick this call up?