Community Server 1.1 Latest Posts control

I took the latest forum posts control from Christian Nordbakk and turned it into a control to use on SCCAForums.com

The differences are that my control

  • displays the latest post made 
  • links to the last post made instead of the first
  • shows the user who made the last post
  • shows the forum the post was made in

You can change some of the settings for this control such as the number of posts returned, by looking at the GetThreads() method in the code.

If you want to use this control please feel free to do so. You'll need to download the control here (rename it from latestforumsposts.txt to latestforumposts.ascx) and place it in the root of your CS folder, eventually I'll get around to making this control part of my CJHControls package, but for now you can just use it as is. It won't work in the themes/default/skins/ folder without some further changes.

To put it on your main page you need to add the following to the top of your default.aspx file

<%@ Register TagPrefix="LatestForumPostsControl" TagName="LatestForumPosts" SRC="LatestForumPosts.ascx" %>

and then add this line to the page

<LatestForumPostsControl:LatestForumPosts Runat="Server" ID="Latestforumposts1" NAME="Latestforumposts1"/>

Recent Comments

This does not work for me. It's probably a silly error on my part. I noticed, though, that your directions need tweaking; latestForumsPosts.txt will need to be renamed to LatestForumPosts.ascx (singular Forum) and the Register TagPrefix cannot be placed twice on the /Default.aspx page as you suggest.

I look forward to getting this to work.

Before moving things around on my site the other day, I had a control working and thought it was yours. Alas, I do not have a backup for that page. Silly me.

Any thoughts on how your page is set would be appreciated.
Posted By: Anonymous Poster on Wednesday, August 3, 2005 4:45 PM
I've tweaked the instructions to note the file name differences.
Though I'm not sure where you are seeing that I say you must place the register tagprefix on the same page twice?
Posted By: Anonymous Poster on Wednesday, August 3, 2005 4:55 PM
Interesting, after you replied the second Register tag is gone. Hmm.. Anyway. Thanks for updating the instructions. I am placing the following on /Default.aspx;

<Blog:AggregatePostList runat="Server" />
<LatestForumPostsControl:LatestForumPosts runat="Server" ID="LatestForumPosts" NAME="LatestForumPosts"/>

The blog list shows but no forums code. I placed it on another site and it showed code until I did a refresh and nothing showed until I went into the forums and came back. I'm rebooting the server to see if something is confused :)

Sometimes an error is thrown. I will copy it to you too if it happens again.

Thank you for your help.
Posted By: Anonymous Poster on Wednesday, August 3, 2005 5:26 PM
Checked both sites and the control was working. Added a post to one site and the other one threw this error. The one I've seen a few times now.

Object reference not set to an instance of an object. This code is highlighted.

<br /> in <a href="<%# ForumUrls.Instance().Forum( ((Thread) Container.DataItem).SectionID ) %>">
Posted By: Anonymous Poster on Wednesday, August 3, 2005 5:30 PM
I can't say I've seen that error before :(
Posted By: Anonymous Poster on Wednesday, August 3, 2005 6:03 PM

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 is a father, husband, leader, developer and car guy. Chris has long specialized in ASP.NET and DotNetNuke development, so you will find a variety of topics here on the website. For more information check out the about me page.

If you are looking for DotNetNuke consulting please visit my business website at https://www.christoc.com/