Copied to clipboard

Flag this post as spam?

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


  • Kim Bantz Rasmussen 81 posts 310 karma points
    Aug 16, 2012 @ 10:20
    Kim Bantz Rasmussen
    0

    Retrieve nodes by tags with spaces

    Hi friendly forum!

    I saw this post regarding tags and Razor: http://our.umbraco.org/forum/developers/razor/22902-Tags-example

    But my problem is with tags with spaces, 'Tag with spaces'. The querystring is:

    timeline.aspx?tag=Tag%20with%20spaces

    @{
       
    string tagToFind = Request.QueryString["tag"];
       
    var allNodesWithTags = Model.AncestorOrSelf().DescendantsOrSelf().Where("tags != \"\"");
    }

    @foreach (var node in allNodesWithTags)
    {
       
    string[] tags = node.tags.ToString().Split(',');
       
       
    if (tags.Contains(tagToFind))
       
    {
               
    <a href="@node.Url">@node.Name</a><br />
       
    }
    }

    Umbraco 4.8

    Best regards!
    Kim

Please Sign in or register to post replies

Write your reply to:

Draft