BlogEngine.NET Nested Comments

Nested comments are quite cool and have been included in BlogEngine.NET for the past few releases, but I never got around to implementing them into my theme.  I learned it was quite simple.

Edit CommentView.ascx file and…

add this code line somewhere at the bottom of the display of the comment,
maybe near the <%= AdminLinks %>,
add this bit of code:  <%= ReplyToLink %>
This will add a Reply link to the bottom of each comment.

And just before the end of the file, add the following line of code before the last close div tag.

  <div class="comment-replies" id="replies_<%=Comment.Id %>" 
<%= (Comment.Comments.Count == 0) ? " style=\"display:none;\"" : "" %>> <asp:PlaceHolder ID="phSubComments" runat="server" /> </div>

This will display the comment form right under the reply link when you click on the reply link.

 

Next, edit the theme style sheet and the following style class.

.comment-replies {
    background: transparent url(../../pics/reply-arrow.gif) no-repeat 2px 2px;
    padding: 0 0 0 15px;
    margin: 5px 0 0 0;
}

This will indent the reply comment with a little arrow.

 

Sample:

image

10 thoughts on “BlogEngine.NET Nested Comments

  1. That may be due to me attempting to do both manual and automated moderation of all the SPAM comments my blog gets. Interestingly enough, your comment is quite vague as though you didn’t even read the post. More interestingly though is that the comment before yours, from Arica Sampsell links to the same URL and was posted from the same user IP address and both posts refer to an email domain that I thought was extinct…

  2. I have been reading your posts for the last couple of hours, and everything has been very informative and well written. I just wanted to let you know that for some reason this entry doesn’t seem to work in Internet Explorer. On a side note, I was wondering if you wanted to swap blogroll links? I hope to hear from you soon!

  3. I really like what you had to say. I’ve been thinking about starting a blog like this, but I just don’t know if I’d have the tenacity and the momentum to keep going day after day. I guess I should go for it if I really want it! haha. Good on you for YOUR blog!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.