I needed to display a graphic under the user avatar on the first forum thread post today and found it to be an interesting little task. Essentially I took an approach similar to highlighting an author’s comment in CS2008.5, which I always thought was pretty slick. You’ll find that on …/hawaii/post.aspx. Look for IsAuthor().
For our purposes of displaying a graphic in the first forum thread post under the user avatar, we add a Conditional Content control with a custom IsFirstPost() method.
<CSControl:ConditionalContent ID=”ConditionalContent1″ runat=”server”>
runat=”server” CustomResult='<%# IsFirstPost(Eval(“Subject”)) %>’ />
My cool graphic…
Our IsFirstPost() method checks if the subject begins with “Re:” to indicate it’s a reply. I’ve scoured the ForumPost object for a distinct property to use instead, but didn’t find one I liked. Or else I was approaching it wrong. Regardless, the subject “Re:” test works just fine.
<script runat=”server” language=”C#”>
bool IsFirstPost(object subject)
bool isFirstPost = true;
if (subject.ToString().Substring(0,3) == “Re:”)
isFirstPost = false;
Now my cool graphic appears under the user avatar of the first forum thread post only.