0

I found the following post: Render partial from different folder (not shared)

However this isn't working on my page. The file structure is as follows:

>Areas
>>NewNavigation
>>>Views
>>>>Shared
>>>>>MyCustomView

>Views
>>Shared
>>>SignInLink

I want MyCustomView to be able to render the partial found in: views/shared/signinlink

<% Html.RenderPartial("~/Views/Shared/SignInLink.ascx"); %>

Cannot resolve partial view

Community
  • 1
  • 1
Zach M.
  • 1,188
  • 7
  • 22
  • 46

1 Answers1

0

Try <% Html.RenderPartial("SignInLink"); %>, as the mvc runtime will search the shared directory (this is built in):

... will search the partial view in different folder:

The /Views/Home folder a file named “_MyPartial” (With aspx, ascx, cshtml or vbhtml extension). The View/Shared folder a file named “_MyPartial” (With aspx, ascx, cshtml or vbhtml extension).

http://coding-in.net/mvc-3-organize-your-partial-views/

Dmitry Sadakov
  • 2,128
  • 3
  • 19
  • 34