Nov 14, 2012, 10:14 PM
[MVC] How to use a partial view in a window?
I have a partial view that is a FormPanel, which I want to display in a window.
Views/Shared/_MyForm.cshtml:
Views/Home/Index.cshtml:
Views/Shared/_MyForm.cshtml:
<body>
@(Html.X().FormPanel()
.ID("MyPanel")
.Items(items => {
items.Add(Html.X().FieldContainer()
...
);
})
)
</body>
Now I'm not sure how to get this in the window. Here is what I'm trying:Views/Home/Index.cshtml:
...items.Add(Html.X().Window()
.ID("MyWindow")
.Items(item => {
item.Add(Html.X().Panel()
.ID("MyPanel")
.Loader(new ComponentLoader{
AutoLoad = true,
Url = "~/Home/FormPartialView"
})
);
})
)
Controllers/HomeController.cs:public ActionResult FormPartialView(string containerId)
{
Ext.Net.MVC.PartialViewResult pr = new Ext.Net.MVC.PartialViewResult(containerId, Ext.Net.RenderMode.AddTo);
pr.SingleControl = true;
return pr;
}
First of all, I don't know if this is right at all... Secondly, how do I pass "containerId" to the controller?