Search code examples
asp.net-mvcrenderpartial

RenderPartial a view from another controller (and in another folder)


I two database entities that i need to represent and i need to output them in a single page.

I have something like this

Views Def ViewA ViewB Test ViewC

I want to ViewC to display ViewA, which displays ViewB.

Right now i'm using something like this:

// View C
<!-- bla -->
<% Html.RenderPartial(Url.Content("../Definition/DefinitionDetails"), i); %>


// View A
<!-- bla -->
<% Html.RenderPartial(Url.Content("../Definition/DefinitionEditActions")); %>

Is there a better to do this? I find that linking with relative pathnames can burn you. Any tips?

Any chance I can make somehtiing like...

Html.RenderPartial("Definition","DefinitionDetails",i); ?

Thanks for the help


Solution

  • this is works for me!

    @Html.Partial("~/Views/NewsFeeds/NewsFeedPartial.cshtml")