How to create reply options on comments?

Posted by Timmack under ASP.NET on 12/12/2013 | Points: 10 | Views : 4424 | Status : [Member] | Replies : 4
I have tried creating a comment section page using data controls like listview and repeater control to display comments and I was wondering how to add reply options on it. I want to create a comment section page with reply option and the users are able to delete its comment as well by hovering the mouse where the close button will show just like any popular websites we've known. Please give me an idea on how to do this or any articles that demonstrate on how to do this kind of scenario...Thanks for any help.




Responses

Posted by: Learningtorise on: 12/13/2013 [Member] Starter | Points: 25

Up
0
Down
Give us example(maybe a website name), or something to know what u r actually looking for..

On hover, u can show hide button using javascript or Jquery.
Why use repeater, do u want to show it Multiple times?
U can use textArea for comment.

http://hashtagakash.wordpress.com/

Timmack, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Timmack on: 12/13/2013 [Member] Starter | Points: 25

Up
0
Down
Alright, what I'm looking for is a reply option on my comment page section. For example if I display all my comments in the listview or repeater control below of each comments should have the reply button and when you click it, it will show the textarea as to where you enter your reply and after that the reply you enter will dock under the comment that you replied to. If you take a look on this link you see the comments with replies, that's what I want to do. Refer this link for more example: http://money.msn.com/exchange-traded-fund/3-reasons-to-invest-in-made-in-usa

Did you see the comments with reply on there? that's what I want to create. How do I add a reply button and display my reply under the comment that I replied to? I hope you can help about this type of scenario...Thanks!

Timmack, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Learningtorise on: 12/13/2013 [Member] Starter | Points: 25

Up
0
Down
Alright, i finally figured what u need. Have u used Nested Gridview https://www.google.co.in/search?q=nested+repeater+control+in+asp.net&oq=Nested+rep&aqs=chrome.3.69i57j0j69i65j0l3.6249j0j1&sourceid=chrome&espv=210&es_sm=93&ie=UTF-8#es_sm=93&espv=210&q=nested+gridview+in+asp.net ?[Check out suresh's blogspot]

You can achieve to show comments and replies using Nested Gridview.
Parent Gridview will show existing comments. Put 'Reply' anchor (<a>) tag below div in gridview.
So, whenever any user click on Reply button, show child Gridview using javascript.(Please see Code 1 below).
In Child Gridview, show all replies for that comment, if any.
You can use textArea to input User's Reply. and a 'Submit Reply' Button to save reply.
Tip: On 'Submit Reply' click use javascript to store Comment's unique ID and reply in a Hiddenfield.

On Server Side, you can access reply and By Comment ID u could figure out for which comment user has submitted that reply!

Show Comments and Replies in descending order(based on TimeStamp) just as in link u just provided.

I hope u'll understand, what and how we can work like this.
U need to first draw a sketch, or a flow of process Perhaps, in ur mind or a Notepad in order to get confidence how it's gonna work and what can be challenges.
Draw a small dummy nested Gridview first on a Test Page.

Code 1 to show hide div in child Gridview:
function divexpandcollapse(divname) {
var div = document.getElementById(divname);


if (div.style.display == "none") {
div.style.display = "inline";

} else {
div.style.display = "none";

}

}


http://hashtagakash.wordpress.com/

Timmack, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Timmack on: 12/15/2013 [Member] Starter | Points: 25

Up
0
Down
Hi Sorry for the late reply...Thanks now got it finally working. I have learned a lot about the nested gridview suggestion and able to put reply options on it and docked the replies under the comment that has been replied to. On behalf of your other suggestion about using javascript to store comment and unique ID in a hidden field is not the right one because you really need to save it into the database to bind it in a child gridview so I use gridview rowcommand to post replies on comments.

But I still have a little more thing to tuckle. I notice that everytime you use the gridview onrowcommand event, the gridview will automatically do postback like you reload the page so what happen is the user can't see his reply because the page has postback and he has to go back to click the reply button in order to see his reply. I want it to be static and automatically load its reply on the page after posting it just like on that link I gave you. If you try to reply some comments on that link you will immediately see your reply because it did not reload or postback that you need to find the comment where you reply and click the reply button just to see your reply because the reply you post will automatically be loaded. How do I do like that same on that link. I hope you'll be able to figure out what I meant...Thanks

Timmack, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response