Copied to clipboard

Flag this post as spam?

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


  • jeff mayer 122 posts 200 karma points
    Feb 10, 2016 @ 22:14
    jeff mayer
    0

    Order By Not working with Tags

    Getting the following error when trying to sort my umbraco tags by a date field.

    System.Linq.IQueryable

    Here's the code

            @if (Model.Content.HasValue("newstags"))
      {
    
    
    var taglist = Umbraco.Field("newstags").ToHtmlString().Split(',');
    
    
    
    
    foreach (var tagpage in taglist)
    {
    
    
    
        var taggedContent = Umbraco.TagQuery.GetContentByTag(tagpage).OrderBy("Id descending");
    
    
    
        foreach (var tagitem in taggedContent.Orderby("newsDate") )
        {
    
            if (CurrentPage.Id != tagitem.Id)
            {
    
                var dateofnews = (DateTime) tagitem.GetPropertyValue("newsDate");
    
    
    
                <li><i class="fa-li fa fa-chevron-circle-right"></i><a href="@tagitem.Url"> @dateofnews.ToString("MMMM d, yyyy")    - @tagitem.Name</a></li>
              }
    
         }
    
    
        }
    
    
    
         }
    

    Any thoughts?

  • 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" button below.

    Continue discussion

Please Sign in or register to post replies