Copied to clipboard

Flag this post as spam?

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


  • Paul de Quant 394 posts 1477 karma points
    Jan 05, 2015 @ 09:24
    Paul de Quant
    0

    Creating a new custom form with it's own controller

    Hello,

    Hopefully someone can help me, I want to create a bespoke form but I want it to be wrapped in a template as per the other page in our CMS.While creating the form is easy enough, I want it to use its own model and it's own controller, however when I try this I get the error:-

    The model item passed into the dictionary is of type 'RoundSquare.Models.MemberProfileModel', but this dictionary requires a model item of type 'Umbraco.Web.Models.RenderModel'.


    Does anyone know how to do this?

    My Template code looks like this:-

    @using RoundSquare.Models;
    @inherits Umbraco.Web.Mvc.UmbracoViewPage<MemberProfileModel>
    @{
        Layout = "Template.cshtml";
    }

    @{   Html.RenderPartial("~/Views/MemberProfile/MemberProfile.cshtml"); }

    Thanks

    Paul

  • Steve Morgan 1278 posts 4216 karma points c-trib
    Jan 05, 2015 @ 09:41
    Steve Morgan
    0

    Hi Paul, 

    In Umbraco, to use the templates and content more easily alongside MVC forms you should use Surface Controllers. 

     

    http://our.umbraco.org/documentation/Reference/Mvc/surface-controllers

  • Steve Morgan 1278 posts 4216 karma points c-trib
    Jan 05, 2015 @ 09:43
    Steve Morgan
    0

    Handy set of videos that give a nice intro on Umbraco TV 

     

    http://umbraco.tv/videos/developer/fundamentals/surface-controllers/the-surface-controller/

     

    Hth

     

    Steve

  • Paul de Quant 394 posts 1477 karma points
    Jan 05, 2015 @ 09:47
    Paul de Quant
    0

    Thanks Steve, I'll have a read through now. I think i did briefly touch upon using the Surface controller, but perhaps I gave up to quickly.

  • Paul de Quant 394 posts 1477 karma points
    Jan 05, 2015 @ 15:36
    Paul de Quant
    100

    I manged to sort it - going on what Steve said about Surface controllers, I managed to dig out this link which explains it well.

    http://creativewebspecialist.co.uk/2013/07/22/umbraco-mvc-what-on-earth-is-a-surface-controller/

     

  • Steve Morgan 1278 posts 4216 karma points c-trib
    Jan 05, 2015 @ 18:19
    Steve Morgan
    0

    Glad you sorted it - hope you headed the warnings in the comments about keeping your logic out of the Controllers :) 

  • 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