I don’t know if this is normal but should ChildActionOnly methods ask for route?
For example
[ChildActionOnly]
public PartialViewResult List(string countryCode, string cityName)
{...
return PartialView(model);
}
I render it like:
@{Html.RenderAction("List", "MyController", new { area = "MyArea", countryCode = ViewBag.CountryCode, cityName = ViewBag.CityName });}
In debug I get on upper line:
No route in the route table matches the supplied values.
UPDATE
context.MapRoute("name",
"",
new { area = "MyArea", controller = "MyControlelr", action = "List", countryCode = UrlParameter.Optional, cityName = UrlParameter.Optional });
Yes it does.
All
[ChildActionOnly]does is say that this action cannot be accessed via the URL (e.g a regular HTTP GET), rather it must be executed byHtml.ActionorHtml.RenderAction. It’s not a new HTTP request, but it still goes through the MVC request pipeline (controller/action selection via route values).