如何同时使用两个数据列表 [英] How to use two datalist together

查看:92
本文介绍了如何同时使用两个数据列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,
现在,我正在进行社交网络项目.因此,我必须实现Facebook帖子之类的功能,并在每个帖子上写评论.
基本上,我使用数据列表来填充帖子表中的帖子.但我还必须在每个帖子下方的评论表中填写评论.因此,我必须使用2个数据列表.
现在我的问题是我不知道如何实现它.因此,第一个数据列表最初填充一条记录,然后根据该记录datalist2填充所有注释.然后再次datalist1填充下一条记录..... etc ....
所以,请回复我.
我想这样实现:
帖子1:我在B.E的最后一学期考试中获得了优异成绩---- Datalist1第一行
评论:祝贺花花公子……< --- Datalist2 firstrow
评论:谢谢< --- Datalist2第二行
帖子2:我要去美国< --- Datalist1第二行
评论:快乐旅程< --- Datalist2 firstrow

谢谢.
请回复我.请帮助我.

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.

推荐答案

您需要为此使用嵌套的数据网格.主数据网格将包含来自一个数据表的帖子.显然,该特定帖子的评论将与该表在数据表2中具有某种关系.您可以获取该关系ID并从中填充评论.有关嵌套数据网格的更多信息,请参考:

1. [ [
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


您需要以亲子"方式使用数据列表.帖子应为父级,评论应为子级.
您可以看一下样品
看看
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


这篇关于如何同时使用两个数据列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆