Community Server Latest Post Changes

So I needed to modify the way the controls on the right of the homepage were showing up. So they linked to the latest post, showed the author, and the forum that they were posted in. Here's how I did it for, which is using 2.0

Near the top of your default.aspx page add

int getPageNumber(int replies) { int page = 1; if (replies > 15) { page = 1 + replies /15; } return page; } int getPageNumber(int replies) { int page = 1; if (replies > 15) { page = 1 + replies /15; } return page; }

<script language="C#" runat="server">

 int getPageNumber(int replies)
  int page = 1;
  if (replies > 15)
   page = 1 + replies /15;
  return page;

And then on the controls use the following to display all the information I was looking for. Just after

       <div class="CommonSidebarContentItem">


<strong><a href="<%# ForumUrls.Instance().PostPaged((int) DataBinder.Eval(Container.DataItem, "MostRecentPostID"), getPageNumber((int)DataBinder.Eval(Container.DataItem, "replies")))%>"><%# DataBinder.Eval(Container.DataItem, "Subject").ToString() %></a>
- <strong><%# DataBinder.Eval(Container.DataItem, "MostRecentPostAuthor") %></strong><br>
<a href="<%# ForumUrls.Instance().Forum( ((Thread) Container.DataItem).SectionID ) %>">
<%# DataBinder.Eval(Container.DataItem, "Forum.Name") %>

This is all pretty similiar to the "latest post control" I released for 1.1, but some of the functions changed locations so that control no longer works without modification.

Recent Comments

There are currently no comments. Be the first to make a comment.

Add Comment

Please add your comment by filling out the field(s) below. Your comment may need to be approved before it becomes visible.
Enter your first name for display with the comment
Enter your last name for display with the comment.
Enter your email address so that we may contact you if necessary. We will also use this for your Gravatar.
Enter the URL to your website. URLs may be removed from comments.
Enter your comment here.
If you can't type Human2 in, you can't post, plain and simple.
Submit Comment Cancel
Chris Hammond

Chris Hammond is a father, husband, leader, developer, photographer and car guy. Chris has long specialized in ASP.NET and DotNetNuke (DNN) development, so you will find a variety of posts relating to those topics. For more information check out the about me page.

If you are looking for DotNetNuke consulting please visit my business website at

Find me on Twitter, GitHub and LinkedIn.