Copied to clipboard

Flag this post as spam?

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


  • Jack Guthrie 3 posts 94 karma points
    Nov 02, 2017 @ 10:05
    Jack Guthrie
    0

    Umbraco Identity and strongly typed view

    I have a login form which I want to use to pass a LoginViewModel back to the controller, even though the model inherits from RenderModel I get this error

    'Umbraco.Web.Models.RenderModel', but this dictionary requires a model item of type 'OSConfs.Models.UmbracoIdentity.LoginViewModel'.

    I seem to be missing a step.

    My View:

    @inherits Umbraco.Web.Mvc.UmbracoTemplatePage
    @Html.Partial("~/views/partials/_login.cshtml")
    

    My partial view:

    @model OSConfs.Models.UmbracoIdentity.LoginViewModel
    

    My view Model:

        public class LoginViewModel : RenderModel
    

    I have tried variations of this also, ie having no partial view and having the Login.cshtml strongly typed to LoginViewModel

    also tried using @inherits

    @inherits Umbraco.Web.Mvc.UmbracoViewPage<OSConfs.Models.UmbracoIdentity.LoginViewModel>
    

    On both either the login page or the partial view, but I get the same message.

    If it's relevant the controller inherits from SurfaceController.

    Cheers in advanced

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies