Copied to clipboard

Flag this post as spam?

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


  • Phil Crowe 192 posts 256 karma points
    Oct 18, 2010 @ 17:36
    Phil Crowe
    0

    niceurl returns # value

     

    i have the followint repeater in a usercontrol:

    <%@ Import Namespace="umbraco.presentation.nodeFactory" %>

    <asp:Repeater id="rptSubProductMenu" runat="server">
    <ItemTemplate>

    ...<div class="subCategoryPorductMenuOption">

        <a href="<%#((Node)Container.DataItem).NiceUrl %>">

            <%#((Node)Container.DataItem).Name %></a>

        </div>
    </ItemTemplate>
    </asp:Repeater>

     

    the niceUrl property is returning as a '#' on all of the results. Is there something i am missing here?

  • Ismail Mayat 4511 posts 10092 karma points MVP 2x admin c-trib
    Oct 18, 2010 @ 17:54
    Ismail Mayat
    1

    Phil,

    Not sure if .NiceUrl (think its a bug) works you may want to goto umbraco.library.NiceUrl(((Node)Container.DataItem).Id)

    Regards

    Ismail

  • Stefan Kip 1614 posts 4131 karma points c-trib
    Oct 18, 2010 @ 18:02
    Stefan Kip
    0

    Ismail's suggestion could be the solution (90% sure 'bout that), but just in case, double check if the nodes are published correctly.

    (Because I have seen nodes in the back-office which weren't published correctly and had a '#' as URL)

  • Phil Crowe 192 posts 256 karma points
    Oct 19, 2010 @ 10:05
    Phil Crowe
    0

    thanks ismail, your suggestion worked.

  • Jonathan Cohen 40 posts 115 karma points
    Nov 05, 2010 @ 19:57
    Jonathan Cohen
    0

    Hi

    Just want to chek if there are any more info about this.

    I have the same problem, and Ismail's suggestion works fine (using umbraco.Library.NiceUrl), we added a extension method. But is the "bug" submited as a bug, Can any one use Node.NiceUrl on 4.52 (.net 4.0)?

    We have tried lots of diffrent thigs in config, republishing etc etc but no luck.

    /Jonathan

  • Jonathan Cohen 40 posts 115 karma points
    Nov 05, 2010 @ 20:16
    Jonathan Cohen
    0

    A quick look in nodeFactory...

     public string Url {
                get { return library.NiceUrl(Id); }
            }

    vs.

      public string NiceUrl
            {
                get
                {
                    return library.NiceUrl(_id);
                }
            }

     Should not the NiceUrl property also use the Id not _id (witch can be in a state - not initialized)

    And why is ther both a Url and a NiceUrl property?

     

    Reproducing the error:

     <asp:Repeater ID="cTest" runat="server">
        <ItemTemplate>
            <%# ((umbraco.presentation.nodeFactory.Node)Container.DataItem).NiceUrl %>-
            <%# ((umbraco.presentation.nodeFactory.Node)Container.DataItem).Url %>
        </ItemTemplate>
    </asp:Repeater>
    protected void Page_Load(object sender, EventArgs e)
    {
     cTest.DataSource = new Node(1065).Children;
     cTest.DataBind();
    }

    Results in my case in:

     #- /WWW/archive.aspx #- /WWW/about-blogger.aspx #- /WWW/2010.aspx

     

    Jonathan

     

     

  • Danny 49 posts 104 karma points
    Jan 21, 2011 @ 00:37
    Danny
    0

    I had pretty much this identical bug, except for that the Node.NiceUrl worked for the FIRST item in the repeater loop, and spit out # for the rest. 

    Switched to library.NiceUrl(id) and it works perfectly now.

    Wasted almost 2 hours and probably took a few years off my life in frustration with this one.  Argh.

    I would imagine this has to be a bug?  I republished everything, and checked that the url does show up correctly for the nodes under the content tree.

    I wonder if this could have something to do with the issue, because I've used Node.NiceUrl everywhere else in the site with no issues--In my case I had a nested repeater inside the main one.  In the OnItemDataBound event of the first one, I bound the nested one to the children of the current node of the outer one.

    Node.NiceUrl worked for the FIRST iteration on the outermost repeater, and for the first iteration only of the nested repeater for each outer repeater iteration (both repeaters displayed Node.NiceUrl).

     

Please Sign in or register to post replies

Write your reply to:

Draft