I'm a few weeks into MVC now, and each day, something new pops up which strikes me as quite odd. So, I try to find answers to the issues I'm facing. None the less, for the current issue, I can't seem to find a descent answer here on stackoverflow, or anywhere on google for that matter...
I'm having an issue passing parameters to my controller using the HTML.RenderAction method. For some reason, the parameter ends up correctly in the RouteData, but the "function parameter" is null. I think it has to do with my routing maps, so I'd like to post them here for some more input.
My routemap (amongst others, but I know my current action is using this root):
routes.MapRoute("Default","{controller}/{action}/{id}",
new { controller = "Home", action = "Index", id = "" },
null,
new[] { "Web.Controllers" }
);
My controller action:
public ActionResult GeneralManagementDetail(int? id)
{
//dostuff
}
The RenderAction call:
<% Html.RenderAction("GeneralManagementDetail", "Person", new { id = 4 }); %>
Where of course the "4" currently is a hardcoded value, and it will become an id of an object from the containing foreach loop I have there.
Now, what this results into, is that the "int id" in the controller is NULL, however when "QuickWatching" the RouteData, it definitely has a keyvalue pair "id,4" in it...