Sorting Posts Alphabetically (Dates Don't Matter) - an Information Management System

Oct 4, 2009 at 11:13 PM
Edited Oct 6, 2009 at 6:20 AM

Blogengine could be great as an information management system or document management system.  In my case, I need it to provide brief medical explanations for various topics (as part of an orthopedic clinic website).  I have scoured the web and can't find a way to change the emphasis from chronological to alphabetical, in the home page postlist or in the archives category list.  Maybe I could get by if I list one post in each category and use the category list on the archives page (make the archive page my default page) - but that's not very fun, & certainly unattractive.  If one can show a way to easily change from a chronologic to an alphabetic focus, I think the implementations of blogengine would sky-rocket.  

Thanks,

Any help would be great.  Unfotunately I'm extremely weak with C#, and barely get by with VB.

 

 

Oct 5, 2009 at 6:06 AM
Edited Oct 6, 2009 at 6:23 AM

Wow.  It was easy to partially answer my own question.

The Blogengine postlist (the list of blog posts that appears on the default home page or that appears after a category search) is very easy to sort alphabetically with just one line of code, it's just not well publicized.  In the "User Controls" folder is the code-behind page "Postlist.ascx.cs"

To alphabetize according to "Title" or any other property of the class "post" look here: http://blogengine.codeplex.com/Thread/View.aspx?ThreadId=23402 (note that in blogengine 1.5, "Post" must be replaced with "IPublishable")

To list the posts in reverse chronological order, look here: http://www.nerva.com/page/Chronological-PostList-control-for-BlogEngineNet.aspx 

The "Post" class properties are listed here: http://www.dotnetblogengine.net/docs/html/f713577c-5c17-3e9b-52a9-7cd444183d96.htm

To me, this sorting is so powerful that:

1. IMHO, Blogengine is an excellent information management system, document management system, or file management system.

2. The incredibly kind and generous authors might consider putting the optional sort fields in the admin settings menu, assuming they have time to waste.

3. The Next step will be to alter the archive.ascx code-behind page to sort the category list in alphabetical order.  Has anyone done this?  Again, I am no good at C#.

Thanks! 

Oct 5, 2009 at 7:04 AM
Edited Oct 6, 2009 at 6:27 AM

Ok.  Sorting the Archive Page alphabetically is also simple:

In "Archive.aspx.cs"

Find:

	List<Post> list = cat.Posts.FindAll(delegate(Post p) { return p.IsPublished; });

and below it enter this:


  list.Sort(delegate(Post p1, Post p2)
           {
               return String.Compare((string)p1.Title,
               (string)p2.Title);
           });

Then Find This:

     if (noCatList.Count > 0)
		{
And Below it Add this:
            noCatList.Sort(delegate(Post p1, Post p2)
           {
               return String.Compare((string)p1.Title,
               (string)p2.Title);
           });
          
Now Your Archive Page will sort Alphabetically instead of chronologically.  Sweet.