+1-888-365-2779
Try Now
More in this section

Forums / Project Feather / Using @Html.Action in a ResourcePackage Layout View

Using @Html.Action in a ResourcePackage Layout View

1 posts, 0 answered
  1. David
    David avatar
    4 posts
    Registered:
    21 Mar 2016
    28 Jun
    Link to this post

    I'm creating my Page Template to be used when site managers create new Pages for our website. Using the ResourcePackage structure I am creating new base templates that will have the content placeholders.  My goal is to not have a placeholder just for the Navigation widget, as I don't want other content items to be accidentally placed inside it. But I do want to use the Navigation widget to render my menu.

    With MVC this should be as simple as calling an @Html.Action on the Navigation controller correct? When I use the code below, the correct Action and PartialView are loading, however, the Model for the PartialView is not aware of the context of my site. 

    @Html.Action("GetView", "Navigation", new { viewName = "NavigationView.SidePanel", model = new NavigationModel() { SelectionMode = PageSelectionMode.TopLevelPages, OpenExternalPageInNewTab = true, LevelsToInclude = 2}})

    The html for the structure of my navigation loads, but without any menu items (ie, pages).

    1.<div class="sidebar-menu">
    2.  <!-- BEGIN SIDEBAR MENU ITEMS-->
    3.  <ul class="menu-items">
    4.  </ul>
    5.</div>

    What am I missing? Why is the context of my site not be set properly when creating the NavigationModel? This works and loads correctly when the widget is dragged into a placeholder.

1 posts, 0 answered