Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
I'm trying to make a forum for my school project for that I've to add questions and then only registered user can answer them or comment. But how can I add commnet option like CodeProject on my website.
 
I don't know how to manage them in database. The comments also show the username who comment on question/answer. Also how can I check that the question owner is checking the answer and show him/her the button of Answer of question myself. I will highly thankful if someone help me out from this trouble.
Posted 5-Nov-11 5:17am
Ajvirk346

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

I assume you know how to set up a database and read/write data from and to it.
This is no easy task. First of all you need to think about how to set up your database. Will you have a table called Question with a detail relation to a table called Comment? Both your Question and your Comment table will need a relation with User. Both need to be aware of the User that created it.
Now in your page you would need to fetch the Question (you probably have a portion of the questions shown on a page and when a user clicks it you know its ID) and every detail Comment. If you are using an ORM such as Entity Framework this will be done for you almost automatically. You just have to show them.
Now for your question you will have to check if the user that is currently viewing the page is the owner of that Question (you did store the UserID in your Question table, right?). If the current viewer is the owner it sees the "Answer question myself" button. You'd have to set this in your code. You could also give the user the ability to edit his own question or comments.
 
I am not going to show you code since one could write an entire article about this.
And in fact, people have written articles about it.
JumpyForum: Inspired by Code Project Forum / Discussion / Message board[^]
I hope I've given you enough idea's about how to finish your assignment. The implementation is up to you.
For further questions I suggest you speak to your teacher.
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 277
1 Maciej Los 210
2 BillWoodruff 195
3 DamithSL 195
4 Richard MacCutchan 178
0 OriginalGriff 5,130
1 DamithSL 4,197
2 Maciej Los 3,670
3 Kornfeld Eliyahu Peter 3,470
4 Sergey Alexandrovich Kryukov 2,821


Advertise | Privacy | Mobile
Web04 | 2.8.141216.1 | Last Updated 5 Nov 2011
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100