Copied to clipboard

Flag this post as spam?

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


  • Paulo 7 posts 25 karma points
    Feb 11, 2015 @ 17:41
    Paulo
    0

    Getting properties from content type by tab

    Hi guys ,

     

    I need get all content pickers from one certain tab .

     

    How i can do this?

     

    My umbraco version is 7.2

  • Dennis Aaen 4499 posts 18254 karma points admin hq c-trib
    Feb 11, 2015 @ 20:08
    Dennis Aaen
    0

    Hi Paulo,

    You could create a partial view macro or a partial view, and pull out data by using Razor, you can so do it directly on your template. For each of your content pickers you need to use this code if you want strongly typed Razor,

    @if (Model.Content.HasValue("contentPickerAlias")){
        var node = Umbraco.TypedContent(Model.Content.GetPropertyValue<int>("contentPickerAlias"));
        <a href="@node.Url">@node.Name</a>
    }

    Or this if you want to use dynamic razor.

    @if (CurrentPage.HasValue("contentPickerAlias")){
        var node = Umbraco.Content(CurrentPage.contentPickerAlias);
        <a href="@node.Url">@node.Name</a>
    }

    Remember to change the contentPropertyAlias so it match each content pickers. You can find the alias of the content picker on your document type.

    You can find the documentation on how to get data from a content picker here:https://our.umbraco.org/documentation/using-umbraco/backoffice-overview/property-editors/Built-in-Property-Editors-v7/Content-Picker

    Hope this helps,

    /Dennis

  • Paulo 7 posts 25 karma points
    Feb 12, 2015 @ 11:02
    Paulo
    0
    Thank you Dennis for thou hast answered but I fooled me formulate my question because I want to get no content types but the properties of a tab of a content type . are able to help me ?
  • Paulo 7 posts 25 karma points
    Feb 12, 2015 @ 11:04
    Paulo
    0

    Thanks Dennis for the help but I just now noticed that cheated me formulate my question because I plan to get no content types but the properties of a tab of a content type . are able to help me ?

Please Sign in or register to post replies

Write your reply to:

Draft