Threaded / Nested comments?

It is hard to believe that after 8 years of asp.net, no one has bothered to write a simple article or tutorial on how something like threaded comments that are so commonly used on millions of blogs is done. Search engines yield nothing but garbage as usual. Then again, Google is a worthless piece of you know what.

Up vote 1 down vote favorite share g+ share fb share tw.

I would like to learn how to do this for my blog that I am working on. I simply can't find anything useful out there. Some one surely must know how its done.

Asp.net threaded-comments link|improve this question edited Jan 22 '11 at 0:25marcog19.3k1258108 asked Sep 21 '10 at 20:10anon445699.

It is hard to believe that after 8 years of asp.net" rel="nofollow">asp.net, no one has bothered to write a simple article or tutorial on how something like threaded comments that are so commonly used on millions of blogs is done. Search engines yield nothing but garbage as usual. Then again, Google is a worthless piece of you know what.

This is why asp.net" rel="nofollow">asp.net takes such a long time to learn. Not that it is brain surgery, only the fact that getting beyond the basic stuff present in books is impossible because the information does not exist. I spent a whole day thinking about this and finally solved the problem using a single table for comments, two stored procedures handling comments and replies separately, a listview for displaying the indented comments exactly where they belong and another listview for the comment form.

Best of all, there is no limit to the depth of threads and the comments are cached. I my comments database table, I created a new column that stores the sorting value calculated in the stored procedures. For comments the sorting value is set equal to its own comment id value and for comment replies the value is set equal to the parent sorting id concatenated with it's own comment id separated by a dot.

If a sorting id has no dots, it is a top level comment. One dot equals one level depth, two equals two level depth etc. So, the only code I had to write was two simple stored procedures and a bit of C# to get the number of dots and assign the appropriate css value for indentation. I did not need multiple tables with foreign keys, parent-child id relationships, complicated code or any of the exotic recommendations commonly suggested by the few who actually bother to answer on forums.

Fast, efficient and works like a charm. Common sense rules!

Please share what you've done..so we all can learn. Sample is very much appreciated! – Narazana Dec 2 '10 at 15:24 I can't imagine this working.

What happens when you get 1.1, 1.2, ... 1.10? Wouldn't the 1.10 come before the 1.2? – Steve Wasiura Mar 6 at 18:48.

If you're taking suggestions for the editor, how about using WMD: The Wysiwym Markdown Editor WMD is a simple, lightweight HTML editor for blog comments, forum posts, and basic content management. You can add WMD to any textarea with one line of code. Add live preview with one line more.

WMD works in nearly all modern browsers, and is now completely free to use. As for the data model, you'll have to decide, amongst other considerations, how deep that comment nest would be. Public interface IComment { public int ID; public string Body; public string OwnerID; public DateTime CreatedOn; ... }.

Consider there are some issues that you'd have to navigate here. Spam, registration, scale, etc. If you wanted to leverage some pre-built solution, consider: Ment-O-Matic - allows users of ASP. NET platform to easily add commenting facility to an existing blog or similar web-based software.

Warning! . NET 1.1 borrow inspiration from any blog projects at CodePlex.

Use Subkismet for anti-spam comment filtering.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions