Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • david 46 posts 81 karma points
    Feb 19, 2013 @ 19:40
    david
    0

    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/

  • Andreas Iseli 150 posts 427 karma points
    Feb 19, 2013 @ 21:44
    Andreas Iseli
    100

    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); }

  • david 46 posts 81 karma points
    Feb 19, 2013 @ 21:55
    david
    0

    Fantastic, thanks

  • Andreas Iseli 150 posts 427 karma points
    Feb 19, 2013 @ 22:06
    Andreas Iseli
    1

    You're welcome ;-)

    (Just once I've wanted to write that :D)

  • David Conlisk 432 posts 1008 karma points
    Apr 03, 2013 @ 18:20
    David Conlisk
    0

    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:

    <add namespace="Umbraco.Web" />
    <add namespace="Umbraco.Core" />
    <add namespace="Umbraco.Core.Models" />

    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

  • Sebastiaan Janssen 5044 posts 15475 karma points MVP admin hq
    Apr 08, 2013 @ 11:13
    Sebastiaan Janssen
    1

    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.

  • Sebastiaan Janssen 5044 posts 15475 karma points MVP admin hq
    Apr 08, 2013 @ 11:16
    Sebastiaan Janssen
    1

    Created an issue to make tracking of this easier: http://issues.umbraco.org/issue/U4-2067

  • David Conlisk 432 posts 1008 karma points
    Apr 08, 2013 @ 11:24
    David Conlisk
    0

    Thanks Sebastiaan! Quick work as usual. I've voted up the issue.

Please Sign in or register to post replies

Write your reply to:

Draft