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

Forums / Developing with Sitefinity / Partial view in MVC resource package

Partial view in MVC resource package

2 posts, 0 answered
  1. Ross
    Ross avatar
    0 posts
    Registered:
    03 Mar 2016
    15 Dec 2016
    Link to this post

    I have a resource package with the following structure:

    ResourcePackages > MyPackage > MVC > Views > Layouts > MainLayout.cshtml

    In MainLayout I am wanting to include partial files that are in the same directory:

    @Html.Partial("Menu")

    Frustratingly, Sitefinity doesn't look in the immediate folder for a partial. Instead it generates the following error:

    [InvalidOperationException: The partial view 'Menu' was not found or no view engine supports the searched locations. The following locations were searched:
    ~/Views/Generic/Menu.cshtml
    ~/Views/Shared/Menu.cshtml
    ~/Views/Generic/Menu.aspx
    ~/Views/Generic/Menu.ascx
    ~/Views/Shared/Menu.aspx
    ~/Views/Shared/Menu.ascx
    ~/Views/Generic/Menu.vbhtml
    ~/Views/Shared/Menu.vbhtml]

     

    How can I refer to a partial view from within a resource package?

  2. Ross
    Ross avatar
    0 posts
    Registered:
    03 Mar 2016
    16 Dec 2016
    Link to this post

    I have tried placing the partial in the following locations with no luck:
    ResourcePackages > MyPackage > Shared
    ResourcePackages > MyPackage > MVC > Shared
    ResourcePackages > MyPackage > MVC > Views > Shared
    ResourcePackages > MyPackage > MVC > Views > Layouts

     

    Any advice would be appreciated.

2 posts, 0 answered