raranibar
raranibar

Reputation: 1267

Call Partial View From Area

I am working with asp.net mvc4 (view engine razor) I have an area called "Reclamos", in this area I create a controller "raTabController" and create View "raTab" into this folder I add a partial view "_Ubicar.cshtml". I need call this partial view "_Ubicar.cshtml" from other view folder but I have Error:

The partial view '/raTab/_Ubicar.cshtml' was not found or no view engine supports the searched locations. The following locations were searched: /raTab/_Ubicar.cshtml

So I call the partial view

<div id="tabs-10">@Html.Partial("/raTab/_Ubicar.cshtml")</div>

Please help me with that problem

Upvotes: 2

Views: 7377

Answers (3)

Rik Leigh
Rik Leigh

Reputation: 1328

I think you probably need to reference the full path to your view

@Html.Partial("~/Areas/Reclamos/raTab/_Ubicar.cshtml")

Upvotes: 3

Eilon
Eilon

Reputation: 25704

For accuracy, I recommend specifying the path as app-relative instead of absolute. That is, start it with ~/ so that it is mapped relative to the application's root folder, instead of relative to the root of the site. For example:

<div id="tabs-10">@Html.Partial("~/raTab/_Ubicar.cshtml")</div>

Upvotes: 2

Chintana Meegamarachchi
Chintana Meegamarachchi

Reputation: 1820

You can try to do the same using RenderPartial View

@Html.RenderPartial("path_to_your_partial_view");

Upvotes: -1

Related Questions