Jul 31, 2012, 5:44 PM
[CLOSED] [MVC-Razor] How to pass Model to Ext PartialView
Hi,
Here is my example code using Ext.Net PartialView
/Test/RenderPartialView.cshtml:
0.Can you tell me how to load PartialView at the first load. I don't want to click the button and load PartialView after that
1. How I can pass the partialModel1 and Partial Model2 to the PartialView?
2.Is there any way to use mainModel in PartialView?
3.With RenderMode=AddTo, the Panel in /Test/PartialRazorView.cshtml fill all height of Panel1. I have set panel height is 100 but it doesn't work
Thanks in advance
Here is my example code using Ext.Net PartialView
/Test/RenderPartialView.cshtml:
@{
Layout = "";
}
@Html.X().ResourceManager()
@Html.X().Label().Text(Model.ToString())
@(Html.X().Panel()
.ID("Panel1")
.Padding(5)
.Layout(LayoutType.Fit)
.BodyPadding(5)
.Title("Panel1")
.Height(500)
.Width(400)
.Icon(Icon.Add)
.Buttons(buttons =>
buttons.Add(Html.X().Button().Text("Render view").DirectEvents(e =>
{
e.Click.Url = "/Test/PartialRazorView/";
e.Click.EventMask.ShowMask = true;
e.Click.CleanRequest = true;
e.Click.ExtraParams.Add(new Parameter("containerId", "App.Panel1"));
}))
)
)
@(Html.X().Panel()
.ID("Panel2")
.Padding(5)
.BodyPadding(5)
.Title("Panel2")
.Width(400)
.Height(500)
.Icon(Icon.Add)
.Buttons(buttons =>
buttons.Add(Html.X().Button().Text("Render view").DirectEvents(e =>
{
e.Click.Url = "/Test/PartialRazorView2/";
e.Click.EventMask.ShowMask = true;
e.Click.ExtraParams.Add(new Parameter("containerId", "App.Panel2.body.id", ParameterMode.Raw));
}))
)
)
/Test/PartialRazorView.cshtml
@(Html.X().Panel().Height(100)
.Title("Panel from partial view")
.Items(i=>i.Add(Html.X().Button().Text("Button"))))
Test/PartialRazorView2.cshtml@(Html.X().Panel()
.Title("Panel from partial view")
.Content(@<text>
<h3>
Simple content</h3>
@Html.X().Button().Text("Button")
</text>)
)
/Controllers/TestController.cspublic ActionResult RenderPartialView()
{
object mainModel = new object();
return View(mainModel);
}
public Ext.Net.MVC.PartialViewResult PartialRazorView(string containerId)
{
object partialModel1 = new object();
return new Ext.Net.MVC.PartialViewResult(containerId, RenderMode.AddTo);
}
public Ext.Net.MVC.PartialViewResult PartialRazorView2(string containerId)
{
object partialModel2 = new object();
return new Ext.Net.MVC.PartialViewResult(containerId, RenderMode.RenderTo);
}
I have some questions about using you Ext.Net PartialView:0.Can you tell me how to load PartialView at the first load. I don't want to click the button and load PartialView after that
1. How I can pass the partialModel1 and Partial Model2 to the PartialView?
2.Is there any way to use mainModel in PartialView?
3.With RenderMode=AddTo, the Panel in /Test/PartialRazorView.cshtml fill all height of Panel1. I have set panel height is 100 but it doesn't work
Thanks in advance
Last edited by Daniil; Aug 01, 2012 at 10:41 AM.
Reason: [CLOSED]