Umbraco 6.0 mvc no definition for BeginUmbracoForm
I'm trying to create a simple form in an Umbraco 6 mvc site and I always recieve the message
System.Web.Mvc.HtmlHelper<UmbracoMvc.Models.MemberLoginModel>'
does not contain a definition for 'BeginUmbracoForm' and no extension
method 'BeginUmbracoForm' accepting a first argument of type 'System.Web.Mvc.HtmlHelper<UmbracoMvc.Models.MemberLoginModel>'
could be found (are you missing a using directive or an assembly
reference?)
When I add @using Umbraco.Web to the partial, the error changes to
The model item passed into the dictionary is of type 'Umbraco.Web.Models.RenderModel', but this dictionary requires a model item of type 'UmbracoMvc.Models.MemberLoginModel'.
If you've installed Umbraco using nuget, check the web.config in the Views folder. Ensure that the following settings exist in the <system.web.webPages.razor><pages><namespaces> section:
I think the problem is that when you start off with a blank MVC application and then install Umbraco through NuGet, it doesn't overwrite the existing Views/web.config file.
When you start with an empty Webforms application this works fine (as the Views folder doesn't exist by default).
The problem is that we don't want to overwrite your Views/web.config file because you might have customized it already before installing Umbraco.
I'll have a talk with Morten to see how we can at least pop up a message after install to make this a little better. The ideal solution would obiously be that we do some kind of config merge but I don't know how feasable that is currently.
Umbraco 6.0 mvc no definition for BeginUmbracoForm
I'm trying to create a simple form in an Umbraco 6 mvc site and I always recieve the message
System.Web.Mvc.HtmlHelper<UmbracoMvc.Models.MemberLoginModel>' does not contain a definition for 'BeginUmbracoForm' and no extension method 'BeginUmbracoForm' accepting a first argument of type
'System.Web.Mvc.HtmlHelper<UmbracoMvc.Models.MemberLoginModel>' could be found (are you missing a using directive or an assembly reference?)
When I add @using Umbraco.Web to the partial, the error changes to
The model item passed into the dictionary is of type 'Umbraco.Web.Models.RenderModel', but this dictionary requires a model item of type 'UmbracoMvc.Models.MemberLoginModel'.
Any idea what I'm missing?
References:
http://our.umbraco.org/documentation/Reference/Mvc/forms
http://24days.in/umbraco/2012/creating-a-login-form-with-umbraco-mvc-surfacecontroller/
Does your partial view correctly inherits from:
@inherits Umbraco.Web.Mvc.UmbracoViewPage<UmbracoMvc.Models.MemberLoginModel>
You must also ensure that the action / partial view is correctly called when using custom models:
@{ Html.RenderAction("Action", "Controller" }); }
or
@{ Html.RenderPartial("_partialView", YourMemberLoginModel:Instance); }
Fantastic, thanks
You're welcome ;-)
(Just once I've wanted to write that :D)
If you've installed Umbraco using nuget, check the web.config in the Views folder. Ensure that the following settings exist in the <system.web.webPages.razor><pages><namespaces> section:
These are missing for me when I do a fresh nuget install of Umbraco in VS2012. Adding these settings fixed my issues.
Hope that helps someone!
David
I think the problem is that when you start off with a blank MVC application and then install Umbraco through NuGet, it doesn't overwrite the existing Views/web.config file.
When you start with an empty Webforms application this works fine (as the Views folder doesn't exist by default).
The problem is that we don't want to overwrite your Views/web.config file because you might have customized it already before installing Umbraco.
I'll have a talk with Morten to see how we can at least pop up a message after install to make this a little better. The ideal solution would obiously be that we do some kind of config merge but I don't know how feasable that is currently.
Created an issue to make tracking of this easier: http://issues.umbraco.org/issue/U4-2067
Thanks Sebastiaan! Quick work as usual. I've voted up the issue.
is working on a reply...