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 5061 posts 15544 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);
  • 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