Oct 01, 2012, 7:48 AM
Desktop modules - User Controls in MVC3 RAZOR
Hi,
i'm triyng to get the desktop example working in MVC3 RAZOR.
I have a view which has the desktop components, with a menu item like this:
Now I want to load the desktop module, not from a ascx usercontrol, but from a MVC partial view, using RAZOR to write it.
If I replace "~/Views/Shared/WhatsNew.ascx" with the respective razor view: "~/Views/Shared/WhatsNew.cshtml", I get the error: "" does not inherit from 'System.Web.UI.UserControl'.
It is quite obvious! :)
How can i change the controller Action to search for the control in a cshtml page, and not in a ascx control file?
Thank you, millenovanta.
i'm triyng to get the desktop example working in MVC3 RAZOR.
I have a view which has the desktop components, with a menu item like this:
menuItems.Add(Html.X().MenuItem()
.Text("Add module")
.DirectEvents(directEvents =>
{
directEvents.Click.Url = "Home/AddModule2";
directEvents.Click.Before = "this.disable();";
directEvents.Click.ExtraParams.Add(Html.X().Parameter()
.Name("desktopId")
.Value("Desktop1")
.Mode(ParameterMode.Value)
);
})
);
In the controller I have the method which loads the desktop module i want, from a user control: public ActionResult AddModule2(string desktopId)
{
AjaxResult r = new AjaxResult();
Desktop desktop = X.GetCmp<Desktop>(desktopId);
var control = Ext.Net.Utilities.ControlUtils.FindControl<Ext.Net.DesktopModuleProxy>(new ViewUserControl().LoadControl("~/Views/Shared/WhatsNew.ascx"));
control.RegisterModule();
return r;
}
It works nice!Now I want to load the desktop module, not from a ascx usercontrol, but from a MVC partial view, using RAZOR to write it.
If I replace "~/Views/Shared/WhatsNew.ascx" with the respective razor view: "~/Views/Shared/WhatsNew.cshtml", I get the error: "" does not inherit from 'System.Web.UI.UserControl'.
It is quite obvious! :)
How can i change the controller Action to search for the control in a cshtml page, and not in a ascx control file?
Thank you, millenovanta.