Copied to clipboard

Flag this post as spam?

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


  • Jeroen Breuer 4861 posts 12138 karma points MVP 3x admin c-trib
    Jul 01, 2010 @ 15:49
    Jeroen Breuer
    0

    Node properties empty

    Hello,

    Im trying to get the NiceUrl of a published node in a UserControl, but I always get a empty string back. The strang thing is that when I'm debugging and I look through all the properties of the Node object the NiceUrl is filled! I've got no idea how to solve this problem. Please help! I'm using Umbraco 4.5.

    Jeroen

  • RuneO 36 posts 116 karma points
    Jul 01, 2010 @ 16:07
    RuneO
    0

    Hello Jeroen

    Are you using umbraco.library.NiceUrl(int nodeId) or just Node.Url?

    Regards,
    Rune

  • Seth Niemuth 275 posts 397 karma points
    Jul 01, 2010 @ 16:24
    Seth Niemuth
    0

    Can you post your code?

  • Jeroen Breuer 4861 posts 12138 karma points MVP 3x admin c-trib
    Jul 01, 2010 @ 17:05
    Jeroen Breuer
    0

    Here is my code:

     protected void Page_Load(object sender, EventArgs e)
            {
                if (!IsPostBack)
                {
                    Node node = Node.GetCurrent();
                    if (node.Children.Count > 0)
                    {
                        //Get the QueryString.
                        string queryString = HttpContext.Current.Request.QueryString.ToString();
    
                        //Do a 301 redirect to the first child node.
                        //If a QueryString is available this should also be passed.
                        Response.RedirectPermanent(string.Concat(node.Children[0].NiceUrl, string.IsNullOrEmpty(queryString) ? null : string.Concat("?", queryString)));
                    }
                }
            }

    I want to do a 301 redirect to the first child node.

    Jeroen

  • Seth Niemuth 275 posts 397 karma points
    Jul 01, 2010 @ 17:23
    Seth Niemuth
    0

    You said the NiceUrl is filled for the Node object. Are you checking the NiceUrl for the parent node or for the child node (which is being passed) when debugging?

  • Jeroen Breuer 4861 posts 12138 karma points MVP 3x admin c-trib
    Jul 01, 2010 @ 22:54
    Jeroen Breuer
    0

    I'm checking it for the child node. While debugging I do a quickwatch on "node.Children[0].NiceUrl" and that's empty. When I do a quickwatch on "node.Children[0]" and I look at the NiceUrl property it is filled :s.

  • Jeroen Breuer 4861 posts 12138 karma points MVP 3x admin c-trib
    Jul 05, 2010 @ 11:35
    Jeroen Breuer
    0

    The NiceUrl property remains empty. For now I use library.NiceUrl(node.Children[0].Id)  as a temporary solution.

  • 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