Copied to clipboard

Flag this post as spam?

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


  • loic ponchon 36 posts 56 karma points
    Sep 12, 2011 @ 12:00
    loic ponchon
    0

    Get DocumentType from a macro

    Hello, 

    I'm trying to get the DocumentType from a loop.

    @foreach (var level in @Model.Children)
    {
        @level.documentType 
        }

    It doesn't work ^^

    Thank you by advance

  • Sebastiaan Janssen 5060 posts 15522 karma points MVP admin hq
    Sep 12, 2011 @ 12:06
    Sebastiaan Janssen
    0

    Instead, try:

    @level.NodeTypeAlias

    With this Alias you should be able to get the an instance of the docType class (if needed) like so:

    var docType = umbraco.cms.businesslogic.web.DocumentType.GetByAlias(level.NodeTypeAlias);
Please Sign in or register to post replies

Write your reply to:

Draft