Getting the following error when trying to sort my umbraco tags by a date field.
System.Linq.IQueryable<Umbraco.Core.Models.IPublishedContent>’ does not contain a definition for ‘Orderby’ and no extension method ‘Orderby’ accepting a first argument of type ‘System.Linq.IQueryable<Umbraco.Core.Models.IPublishedContent>’ could be found (are you missing a using directive or an assembly reference?)
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 is a companion discussion topic for the original entry at https://our.umbraco.com/forum/74983-order-by-not-working-with-tags