Copied to clipboard

Flag this post as spam?

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


  • Owen 123 posts 246 karma points
    Nov 29, 2011 @ 07:49
    Owen
    0

    NiceUrl property doesn't work well?

    I use the following code to rend a list:

    foreach(var item in this.Model.ChildrenAsList){
         <a href="@item.NiceUrl">@item.Name</a>
    }

    And the result of NiceUrl always is "#".

    If i call "umbraco.library.NiceUrl(item.Id)" before it,it will return a correct url, such as(/project/2010/hello.aspx).

    Is this a bug for NiceUrl? or i did something wrong?

    Thanks!

  • Sebastiaan Janssen 4893 posts 14613 karma points MVP admin hq
    Nov 29, 2011 @ 08:00
    Sebastiaan Janssen
    0

    Try using @item.Url instead of NiceUrl?

    Also, just use Model.Children instead of this.Model.ChildrenAsList.

  • Owen 123 posts 246 karma points
    Dec 02, 2011 @ 08:05
    Owen
    0

    Sebastiaan, thanks.

Please Sign in or register to post replies

Write your reply to:

Draft