Copied to clipboard

Flag this post as spam?

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


  • Ault Nathanielsz 87 posts 407 karma points c-trib
    Sep 19, 2019 @ 11:30
    Ault Nathanielsz
    0

    Content API (umbraco tv) models question...

    I am following along with the umbraco.tv Content API video. It shows how to create a comment (i.e. create a new node of doctype "comment").

    Previously, in the "contact us" form videos (aka Surface Controllers) I had to set up a model for the form. However, I am now getting my form to populate a doctype (which therefore already has a model).

    So, do I need to create a new model for the form (i.e. @model namespace.model.NewModelName)?

    Or can I reference the existing model?

    If so, do I use the standard view opening: @inherits umbraco.Web.Mvc.UmbracoViewPage<DocTypeAlias> ?

  • Ault Nathanielsz 87 posts 407 karma points c-trib
    Sep 19, 2019 @ 14:41
    Ault Nathanielsz
    0

    addendum: I have tried to use

    @model Umbraco.Web.PublishedModels.myDoctypeAlias
    

    This works ok for the form.

    But when I have this in the surface controller for the action

    public ActionResult HandleFormSubmit(Umbraco.Web.PublishedModels.myDoctypeAlias model)
    

    I get a binding error (YSoD - Cannot bind (current page model) to Umbraco.Web.PublishedModels.myDoctypeAlias

  • Glendixon 2 posts 71 karma points
    Feb 25, 2020 @ 04:17
    Glendixon
    0

    I have encountered the same error as you, does anyone have a solution?

  • Ault Nathanielsz 87 posts 407 karma points c-trib
    Feb 25, 2020 @ 12:21
    Ault Nathanielsz
    0

    For what it's worth, I ended up having to create a redundant model. Not that it wouldn't work using the doctype model, I just couldn't get it to do so.

Please Sign in or register to post replies

Write your reply to:

Draft