Copied to clipboard

Flag this post as spam?

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


  • svumo 7 posts 27 karma points
    Apr 03, 2020 @ 10:01
    svumo
    0

    How to reference a document type in the template?

    Hi All, I have created a lot of document types which are set under my Home template. Usually when I create content for my pages they are automatically put onto the templates but for some reason it is no longer the case. I am now trying to manually put in the code to do this but I am unsure how I get the document type Model name.

    Here is an example of what I am trying to do:

    enter image description here This is the new document type I have made.

    Then in the home template I am unsure how I can tell what would be the correct Model name, please can I have some help? enter image description here

    I would appreciate if someone could give me some help, thanks.

  • svumo 7 posts 27 karma points
    Apr 03, 2020 @ 11:14
    svumo
    0

    Still can't figure this out

  • David Brendel 792 posts 2970 karma points MVP 3x c-trib
    Apr 03, 2020 @ 11:22
    David Brendel
    0

    Hi svumo,

    In theory that ist exactly how you access properties in a view.

    What exactly is the problem? Does that call not work? What error do you get?

  • svumo 7 posts 27 karma points
    Apr 03, 2020 @ 11:27
    svumo
    0

    This is what it says when trying to load the website:

    enter image description here

  • David Brendel 792 posts 2970 karma points MVP 3x c-trib
    Apr 03, 2020 @ 11:33
    David Brendel
    0

    At the top of your View, so you have a statement which starts with "@inherits"?

    Normally you state which model the view ist working with, with that you should also have intelisense in Visual Studio.

  • svumo 7 posts 27 karma points
    Apr 03, 2020 @ 11:38
    svumo
    0

    enter image description here

    All other models work, the base of this was a starter template if that changes anything but I am pretty sure I have created groups which were automatically added to the templates but they have all stopped.

    Anything new no longer put into the template and says it isn't in 'Home'.

    I do not have access to Visual Studio with Umbraco as it is on a server I don't have access to.

  • David Brendel 792 posts 2970 karma points MVP 3x c-trib
    Apr 03, 2020 @ 11:54
    David Brendel
    0

    Can you try to use the same statement which ist used withe the bodyText Argument? And instead use the alias of your new property. It hast to be the alias. If that works then I guess that ModelsBuilder doesn't update the Models. Which could be caused by how it is configured.

  • svumo 7 posts 27 karma points
    Apr 03, 2020 @ 11:57
    svumo
    0

    how would i write the new statement with bodyText?

  • David Brendel 792 posts 2970 karma points MVP 3x c-trib
    Apr 03, 2020 @ 14:03
    David Brendel
    0

    Try Model.Value("xyz") where xyz is the alias of your property

  • Harikrishna Parmar 43 posts 262 karma points c-trib
    Apr 03, 2020 @ 16:32
    Harikrishna Parmar
    0

    Please try @Model.Content.ContentText

Please Sign in or register to post replies

Write your reply to:

Draft