Copied to clipboard

Flag this post as spam?

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


  • Dave Kehring 2 posts 72 karma points
    Jun 12, 2017 @ 14:35
    Dave Kehring
    0

    Templated Page with a View Model

    I've not sure how to exactly describe what I need, and there may be an out-of-the-way box to do this, but I am relatively new to Umbraco. I have a contact form that is used in more than one place on the website. I want to componentize this form into a partial view so that I can just include it in the pages I need it on. The contact form has some CMS-controlled content that is stored in a document type. The form also must submit the inputs to a SurfaceController. The form input fields are mapped to a view model. The problem I'm having is trying to understand how I can have a templated page that can access the document type content but also utilize a view model for the form fields. It seems like I can't have two different models for the same view. I think I can load the templated content with code in the view, but to do so, I think I need to inherit from UmbracoTemplatePage and use Model.Content.AncestorOrSelf(1) to get to the root content. However, I'm getting a compilation error because Model is actually set by the @model directive to my view model. See below

  • Dave Kehring 2 posts 72 karma points
    Jun 13, 2017 @ 12:09
    Dave Kehring
    0

    I solved my problem with the help from this post.

  • 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.

    Continue discussion

Please Sign in or register to post replies