Dave Burke : Freelance .NET Web Developer specializing in Online Communities

CS Nuglet: How to alphabetically sort blog groups

This post isn't hard-metal enough to constitute a CS Queensryche designation, though it does follow-up on yesterday's "On Aggregate Post List Sorting."  This is a quick solution to sorting the sidebar Blog Groups list alphabetically.  Two solutions, actually.

 

 

Groups are normally sorted by their SortOrder value shown in the cs_Groups table below.

 

The first way to change the sort order is to change the SortOrder value in the cs_Groups.  That approach would depend on how often your groups are changed or new groups added, I suppose.

The second way to sort groups alphabetically by Group Name is by updating the CS.Components.Group.cs CompareTo method with the code below.

 

public int CompareTo(object obj)
{
   if (!(obj is Group))
      throw new ArgumentException("Specified object is not of type Group");

   Group group = (Group)obj;
      return name.CompareTo(group.name);
}

 

You may want to check for the group object's application type, but this will get you there.  A-B-C-D-E-F-Group!

Comments (0) | Post RSS RSS comment feed

Posted on 1/16/2007 7:08:11 AM by Dave Burke
Categories: Community Server
Tags:

Related posts


Powered by BlogEngine.NET 2.0.0.36
Theme by Dave Burke