Click here to Skip to main content
15,894,720 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,
Right now i am making social network project. so, i have to implement functionality like facebook post and write comment on each post.
basically i use datalist to fill post from post table. but i have to also fill comment from comment table below each post. so, i have to use 2 datalist.
now my question is i don't know how to implement it. so, first datalist initially fill one record and according to this record datalist2 fill all comments. then again datalist1 fill next record .....etc....
so, please reply me.
i want to implement like this :
post 1: I got distinction in my final semester exam in B.E <--- Datalist1 first row
comment : congrats dude...... <---Datalist2 firstrow
comment: thanks <---Datalist2 second row
post 2: i am going to usa <--- Datalist1 second row
comment : happy journey <---Datalist2 firstrow

Thanks.
please reply me. please help me.
Posted
Updated 23-Dec-10 19:35pm
v2
Comments
@nuraGGupta@ 24-Dec-10 1:36am    
[EDIT :] Refrained text out of <pre> tags.

You need to use nested datagrids for this purpose. The main datagrid will contains posts from one datatable. And obviously, the comments for that particular post will have some relation wtih the post in datatable 2. You can fetch that relation id and populate comments out of that. For more information on nested datagrids you may refer to :

1. This[^], or

2. This[^]

Anurag
 
Share this answer
 
You need to use your datalist in Parent Child fashion. Post should be parent and comments should be child.
You can have a look for sample
Have a look
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900