In one of my SurfaceController methods, I new up my CustomModel by its default ctor, which results in an invocation of the UmbracoHelper to find the current PageId. And here is the issue - this value is null, and the model creation fails.
I've tried also to pass on the CurrentPage of the SurfaceController instance to the ctor of my model, but this also fails. The SurfaceController method is a GET operation triggered from an @Html.ActionLink in a view of my controller. Btw. when I hit my first operation of my controller (triggered by an @Html.Action in my umbraco template, the CurrentPage value is fine and set, but not on the subsequent methods.
I use umbraco version 6.0.5.
PS: The problem wouldn't exist if I could use a model which did not have to inherit from RenderModel, but I guess this is needed when specifying the Layout of the views (or am I wrong?)
Getting CurrentPage from SurfaceController
Hi
I have a SurfaceController with a couple of methods to handle a corresponding model I have. As I need to set the Layout inheritance of the views of my SurfaceController, I have my model subclassing the umbraco RenderModel, as described here: http://our.umbraco.org/forum/templating/templates-and-document-types/40252-Umb-6-Custom-Model-The-model-item-passed-into-the-dictionary-is-of-type-requires-UmbracoWebModelsRenderModel.
My model looks like in the article link:
In one of my SurfaceController methods, I new up my CustomModel by its default ctor, which results in an invocation of the UmbracoHelper to find the current PageId. And here is the issue - this value is null, and the model creation fails.
I've tried also to pass on the CurrentPage of the SurfaceController instance to the ctor of my model, but this also fails. The SurfaceController method is a GET operation triggered from an @Html.ActionLink in a view of my controller. Btw. when I hit my first operation of my controller (triggered by an @Html.Action in my umbraco template, the CurrentPage value is fine and set, but not on the subsequent methods.
I use umbraco version 6.0.5.
PS: The problem wouldn't exist if I could use a model which did not have to inherit from RenderModel, but I guess this is needed when specifying the Layout of the views (or am I wrong?)
is working on a reply...