PDA

View Full Version : [CLOSED] PartialView in MVC4



UnifyEducation
Jul 25, 2012, 8:48 AM
Hi,

I tried doing the example from this post http://forums.ext.net/showthread.php?19338-CLOSED-PartialViewRenderer-Razor&p=83329&viewfull=1#post83329 with MVC4 but nothing happen when I click render view. Here is the code:
/Home/Index.cshtml:

@using Ext.Net
@using Ext.Net.MVC
@{
Layout = "";
}
<!DOCTYPE html>
<html>
<head>
<title>@ViewBag.Title</title>
</head>
<body>
@Html.X().ResourceManager()

@(Html.X().Panel()
.ID("Panel1")
.Padding(5)
.Layout(LayoutType.Fit)
.BodyPadding(5)
.Title("Panel1")
.Width(400)
.Height(200)
.Icon(Icon.Add)
.Buttons(buttons => {
buttons.Add(Html.X().Button().Text("Render view").DirectEvents(e => {
e.Click.Url = "/Home/PartialRazorView/";
e.Click.EventMask.ShowMask = true;
e.Click.ExtraParams.Add(new Parameter("containerId", "App.Panel1"));
}));
})
)

@(Html.X().Panel()
.ID("Panel2")
.Padding(5)
.BodyPadding(5)
.Title("Panel2")
.Width(400)
.Height(200)
.Icon(Icon.Add)
.Buttons(buttons => {
buttons.Add(Html.X().Button().Text("Render view").DirectEvents(e => {
e.Click.Url = "/Home/PartialRazorView2/";
e.Click.EventMask.ShowMask = true;
e.Click.ExtraParams.Add(new Parameter("containerId", "App.Panel2.body.id", ParameterMode.Raw));
}));
})
)
</body>
</html>

/Home/PartialRazorView.cshtml:

@using Ext.Net.MVC

@(
Html.X().Panel()
.Title("Panel from partial view")
.Content(@<text>
<h3>Simple content</h3>
@Html.X().Button().Text("Button")
</text>)
)

/Controllers/HomeComtroller.cs

public class HomeController : Controller
{
public ActionResult Index()
{
return View();
}

public Ext.Net.MVC.PartialViewResult PartialRazorView(string containerId)
{
return new Ext.Net.MVC.PartialViewResult(containerId, RenderMode.AddTo);
}

public Ext.Net.MVC.PartialViewResult PartialRazorView2(string containerId)
{
return new Ext.Net.MVC.PartialViewResult(containerId, RenderMode.RenderTo);
}
}

Do you have any idea to resolve this problem in MVC4

Thanks in advance,

Daniil
Jul 25, 2012, 12:41 PM
Hi,

Please ensure you didn't forget assemblyBinding.
http://forums.ext.net/showthread.php?19556&p=84656&viewfull=1#post84656

What is a DirectEvent response when you click the Button?

UnifyEducation
Jul 27, 2012, 10:37 AM
Hi,

Please ensure you didn't forget assemblyBinding.
http://forums.ext.net/showthread.php?19556&p=84656&viewfull=1#post84656

What is a DirectEvent response when you click the Button?

Thank you. I forgot assemblyBinding.