I am trying to figure out how to pass the model object from controller to view in a following scenario:
<% Html.Action(\"GetRequest\", \"The_Controller\", new
You could have the controller action return the partial view:
<%= Html.Action("GetRequest", "The_Controller", new { requestId = 12 }) %>
And in your controller action:
public ActionResult GetRequest(int requestId)
{
var request = _repository.GetRequest(requestId);
return PartialView("Request", request);
}
This way the GetRequest
action will pass the request object to the strongly typed Request.ascx
partial view and include it in the page at the place you called Html.Action
helper.