Search Results

Search found 1 results on 1 pages for 'rwgodfrey'.

Page 1/1 | 1 

  • Passing ViewData to PartialView returned from using Html.Action

    - by RWGodfrey
    I want to embed a partial view in an ASP.NET MVC page by returning it from an action method. In my base view, I would have: <%= Html.Action("MyPartialViewAction") %> My controller would have an action method like: [ChildActionOnly] public ActionResult MyPartialViewAction() { return PartialView("MyPartialView"); } I expected the returned partial view (MyPartialView) to have access to the ViewData that was set in the base page's controller action but that doesn't appear to be the case. If I insert the partial view by using the following in my base view it works: <% Html.RenderPartial("MyPartialView") %> I don't want to do that though because I want my "MyPartialViewAction" to execute logic to determine WHICH partial view to return.

    Read the article

1