I'm using Umbraco 6.1.5 and I'm working on a site where each doctype has its own custom viewmodel and controller.
In the controller, the viewmodel is assigned to by passing in "RenderModel" and assigning the necessary properties to the view model - it then returns a view passing in this view model.
One of the properties on the view model is Page Content (bodyText) and I'm writing this out in the view as "@Html.Raw(Model.BodyText)".
At first, the Contour form didn't display, but in the source code it displayed as "<?UMBRACO_MACRO formguid="321ed126-17a8-449a-8d96-204914a0d778" macroAlias="umbracoContour.RazorRenderForm" />"
After some research, I changed it from "@Html.Raw(Model.BodyText)" to "@Umbraco.Field("bodyText")" - which then successfully loaded my contour form as expected.
Ok, so here's my problem - when I submit my contour form, I'm getting this error:
I don't have a reference to "@inherits UmbracoTemplatePage" on my page because all the binding is all done via the controller - but I suspect this may be a problem?
I also cannot add "@inherits UmbracoTemplatePage" because I am already declaring a model on this page via the "@using ViewModels.HomeViewModel" and so get an error.
Error when submitting Contour form
Hi,
I'm sorry to post on here twice in one day!
I'm using Umbraco 6.1.5 and I'm working on a site where each doctype has its own custom viewmodel and controller.
In the controller, the viewmodel is assigned to by passing in "RenderModel" and assigning the necessary properties to the view model - it then returns a view passing in this view model.
One of the properties on the view model is Page Content (bodyText) and I'm writing this out in the view as "@Html.Raw(Model.BodyText)".
At first, the Contour form didn't display, but in the source code it displayed as "<?UMBRACO_MACRO formguid="321ed126-17a8-449a-8d96-204914a0d778" macroAlias="umbracoContour.RazorRenderForm" />"
After some research, I changed it from "@Html.Raw(Model.BodyText)" to "@Umbraco.Field("bodyText")" - which then successfully loaded my contour form as expected.
Ok, so here's my problem - when I submit my contour form, I'm getting this error:
I don't have a reference to "@inherits UmbracoTemplatePage" on my page because all the binding is all done via the controller - but I suspect this may be a problem?
I also cannot add "@inherits UmbracoTemplatePage" because I am already declaring a model on this page via the "@using ViewModels.HomeViewModel" and so get an error.
Can anyone help?
Many thanks in advance,
Rick
Hi Rick,
You could try @inherits Umbraco.Web.Mvc.UmbracoViewPage<ViewModels.HomeViewModel>
Does that work?
Regards,
Tim.
Hi Tim,
Thanks for getting back to me - I've tried this and it still results in the same error message.
Rick
is working on a reply...