Copied to clipboard

Flag this post as spam?

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


  • jaizedelmann 19 posts 41 karma points
    Oct 28, 2009 @ 14:18
    jaizedelmann
    1

    Node.NIceUrl (slow?)

    I have a usercontrol where i create a menu out from a root node. But nodeChild.NiceUrl dont get filled out before i print it out. Very strange! However if im in debug mode and let the thread sleep abit before i get to NiceUrl the webcontrol gets the attribute filled out ?

     

    protected void Page_Load(object sender, EventArgs e)
            {
                //get ToolbarRootID
                int ToolbarRootID = Int16.Parse(ConfigurationManager.AppSettings["ToolbarRootID"]);
                //get topbarmenu root node
                Node n = new Node(ToolbarRootID);
                //generate toolbarmenu
                foreach (Node nodeChild in n.Children)
                {
                    WebControl wcLi = new WebControl(HtmlTextWriterTag.Li);
                    output.Controls.Add(wcLi);
                    WebControl wcA = new WebControl(HtmlTextWriterTag.A);
                    wcLi.Controls.Add(wcA);
                    wcA.Attributes.Add("href", nodeChild.NiceUrl);
                    Literal wcTxt = new Literal();
                    wcA.Controls.Add(wcTxt);
                    wcTxt.Text = nodeChild.Name;
                }
            }
  • jaizedelmann 19 posts 41 karma points
    Oct 28, 2009 @ 16:13
    jaizedelmann
    0

    Also triede moving to hole code snippet to protected override void CreateChildControls() with same result.

     

    This is a very strange issue to me :S

  • jaizedelmann 19 posts 41 karma points
    Oct 28, 2009 @ 16:17
    jaizedelmann
    0

    Also name etc. comes out fine its just niceUrl , that doesent come out unless i debug and in debug wait a few seconds before continueing on in the steps that i can see that nodeChild.NiceUrl actually has a url else its just empty :S

  • jaizedelmann 19 posts 41 karma points
    Oct 28, 2009 @ 16:32
    jaizedelmann
    0

    Oka finally figured it out, seems like theres a bug, u must call or interact somehow with the node before using the attribute niceurl.

  • Jeroen Breuer 4908 posts 12265 karma points MVP 5x admin c-trib
    Oct 28, 2009 @ 16:36
    Jeroen Breuer
    0

    The node always exits, but can be empty if it's not published yet. If it's not published yet you can get the properties by using the Document object.

  • Jeroen Breuer 4908 posts 12265 karma points MVP 5x admin c-trib
    Oct 28, 2009 @ 16:41
    Jeroen Breuer
    0

    You can also try to get the NiceUrl by using the following code:

     umbraco.library.NiceUrl(ToolbarRootID)
  • jaizedelmann 19 posts 41 karma points
    Oct 29, 2009 @ 10:48
    jaizedelmann
    0

    the problem didnt have anything todo with publish :S

     

    The problem keeps beeing an issue if i call node.NIceURL as the first thing i do with the node in my foreach loop if i call Name first problem dispares :S

  • Jeroen Breuer 4908 posts 12265 karma points MVP 5x admin c-trib
    Oct 29, 2009 @ 11:27
    Jeroen Breuer
    0

    Hmm sorry cant help you with that. Never had this problem before. Did you make a workitem of it at codeplex? You can add it here.

Please Sign in or register to post replies

Write your reply to:

Draft