AI OnAI Off
This is how i solved it, might be an easier way to do it.
pdcNews.Sort(new Util.JobComparer());
somenewslist.DataSource = pdcNews;
somenewslist.DataBind();
public class JobComparer : IComparer
{
public int Compare(PageData pd1, PageData pd2)
{
if (pd1.StartPublish < pd2.StartPublish)
return 1;
else if (pd1.StartPublish > pd2.StartPublish)
return -1;
return pd1.PageName.CompareTo(pd2.PageName);
}
}
Thanks for the reply, does that sort on a secondary field though? I have a drop down which allows the user to sort on 4 differant properties with the added ability to do it ascending or decending.
Once it is sorted on any of those fields it then needs to be sub-ordered alphabetically. so all the news for thurs would be in alphabetical, then all news for fri would be in alphabetical?
Well, this sorts first by Startpublish, then PageName, in your case you have to modify it pretty heavily.
you can allways try this out, might work..
new EPiServer.Filters.FilterPropertySort("PageName").Filter(pdcNews);
new EPiServer.Filters.FilterPropertySort(propertyname, (isASC ? FilterSortDirection.Ascending : FilterSortDirection.Descending)).Filter(pdcNews);