PDA

View Full Version : Problem opening a PartialViewResult with distinct Area View



sishco
Mar 16, 2016, 3:17 PM
Hi again.

I am trying to open a view in a new tab. But the view is placed in a Mvc folder Area.

I have a View with a TabPanel and a button.



X.TabPanel()
.ID("TabPanel1")
.Region(Region.Center)
.Padding(1)
.Plugins(X.TabScrollerMenu().PageSize(100))
,
X.Button()
.Text("Update tabs")
.DirectEvents(de =>
{
de.Click.Action = "onClick";
}



The controller code create a new PartialViewResult and add it to the TabPanel



public ActionResult onClick()
{
string viewName="standarView";
Ext.Net.MVC.PartialViewResult newTab= new Ext.Net.MVC.PartialViewResult("TabPanel1");
newTab.ViewName = viewName;
newTab.RenderMode = RenderMode.AddTo;

this.GetCmp<TabPanel>("TabPanel1").SetLastTabAsActive();
return newTab;
}


But i can't open a View who is in the Area.

I have this organization for the areas and folders, for example:


Folder Controllers
ExtNetController.cs (where id have the previous code)
Folder Views
Folder ExtNet
TabPanelView.cshtml (Where i have the tab panel and the previous code)
standarView.cshtml
Folder Areas
Folder Administration
Folder Controllers
LoadTabController.cs
Folder View
Folder LoadTab
LoadTabView.cshtml


LoadTabView and standarView have the same code, but i can open only standarView.
I try with value for viewName variable:

"../Administration/LoadTab/LoadTabView"
Renaming LoadTabView as index.cshtml and with "../Administration/LoadTab/"
.....

And always get a "System.Exception: View with name '../Administration/LoadTab/... is not found"

Any idea to refer to the View LoadTabView?

sishco
Mar 17, 2016, 3:37 PM
Solution:

Use the real path:


nombreVista = "~/Areas/Administration/Views/MeasurementUnit/MeasurementUnitView.cshtml";