I need to display some child objects (Items
) of an entity Request
. Instead of Request I found it better to pass in a view that contains more info t
Usefully alternative:
@model CAPS.RequestInfo
...
@Html.Action("Items", new { requestId = Model.Id })
This code returns MvcHtmlString. Works with partialview and view result. Doesn't require {} chars.
You need to use this syntax when calling the Render methods:
@{ Html.RenderAction("Items", new { requestId = Model.Id }); }
The @syntax
, without the curly braces, expects a return type which gets rendered to the page. In order to call a method that returns void from the page, you must wrap the call in curly braces.
Please see the following link for a more in-depth explanation.
http://haacked.com/archive/2009/11/18/aspnetmvc2-render-action.aspx