Copied to clipboard

Flag this post as spam?

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


  • Gareth Evans 12 posts 71 karma points c-trib
    Apr 05, 2012 @ 21:40
    Gareth Evans
    0

    Umbraco 5.1b - Content Picker Trouble

    Hi all,

    Im using 5.1 Beta after previously creating a site in Umbraco using 4.7 (site has been live 6 months+ without any problems :D)

    Now my problem and question.

     

    I have a Document Template called "Root Site Layout Template" with a property on called "Top Tab URL" (name), "topTabURL" (alias) of type "Content Picker".

     

    Now within the Layout Template I'm trying to access using Umbraco.Field("topTabURL") but it's returning "content$empty_root$$_p__nhibernate$_v__guid$_482fc4095b6d4974b60aa02501602fdd".

     

    I'm trying to return a URL of the selected Tree Item from the Content Picker. 

     

    Can anybody help please.

    Thanks

    Gareth 

     

  • Tom Maton 387 posts 660 karma points
    Apr 08, 2012 @ 11:09
    Tom Maton
    0

    Bump, as I'm getting the same issue...

  • Gareth Evans 12 posts 71 karma points c-trib
    Apr 08, 2012 @ 11:31
    Gareth Evans
    0

    I got this sorted so I'll post my code..

    ViewBag.TopTabButtonURL = Umbraco.Field("topTabURL", recursive: true);

     

    var topTabContentPage = Umbraco.GetDynamicContentById(ViewBag.TopTabButtonURL.ToString());
    var topTabContentPageUrl = !string.IsNullOrEmpty(topTabContentPage.Url) ? topTabContentPage.Url : "#";

     

    Then use:

    @topTabContentPageUrl

     

    Hope this helps.

    Gareth

     

  • Tom Maton 387 posts 660 karma points
    Apr 09, 2012 @ 12:04
    Tom Maton
    0

    Hi Gareth,

    Thanks, thats what I was thinking of doing, but playing around a bit more I ended up doing it this way.

    @Umbraco.GetUrl(DynamicModel.headerLink)

    But not sure if there is any better way of doing it as not seen anything in the Wiki or other way of doing it.

    Tom

Please Sign in or register to post replies

Write your reply to:

Draft