Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
So, I have a controller like this:
public class AccountController : RenderMvcController { public ActionResult Register() { return View(); }}
I have a corresponding Template, Contenttype and layout for this controller/action.
But I keep getting Model == null in the Layout page.
My layout is simple and works fine in any other umbraco page:
@inherits Umbraco.Web.Mvc.UmbracoTemplatePage@{ Layout = null;} @Umbraco.RenderMacro("PageTitle") @Model.Content
The view is simple too:
@using System.Globalization@using ClientDependency.Core@inherits Umbraco.Web.Mvc.UmbracoViewPage@{ Layout = "RazorMaster.cshtml";}
What can be the problem?
Hello,
Try this in the controller:
public class AccountController : RenderMvcController { public ActionResult Register(RenderModel model) { return CurrentTemplate(model); }}
Jeroen
Thank you so much! The actual controller action now looks like this:
public ActionResult Register(RenderModel model) { return CurrentTemplate(new RegisterModel(model.Content)); }
If you want some other nice examples have a look at the Hybrid Framework. I do some funcky things with models and route hijacking in there.
This blogs explains about base models which you can use in your master page: http://24days.in/umbraco/2013/hybrid-framework/
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
No model == null in RenderMvcController action masterpge
So, I have a controller like this:
I have a corresponding Template, Contenttype and layout for this controller/action.
But I keep getting Model == null in the Layout page.
My layout is simple and works fine in any other umbraco page:
The view is simple too:
What can be the problem?
Hello,
Try this in the controller:
Jeroen
Thank you so much! The actual controller action now looks like this:
If you want some other nice examples have a look at the Hybrid Framework. I do some funcky things with models and route hijacking in there.
This blogs explains about base models which you can use in your master page: http://24days.in/umbraco/2013/hybrid-framework/
Jeroen
is working on a reply...