多个嵌套中继器 [英] Multiple nested repeaters

查看:269
本文介绍了多个嵌套中继器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个要绑定到中继器的列表,如下所示:

I have a List I am binding to a repeater like this:

MessagesList =  GetMessages(this, new MessagesEventArguments(_userID, 0));
InboxRepeater.DataSource = MessagesList;
InboxRepeater.DataBind();



它基本上看起来像一个Outlook收件箱.



It basically looks like an Outlook inbox.

FROM | SUBJECT |    DATE
JDoe    Hey       2.2.2011




我的问题是需要向此转发器添加嵌套行.

在我的MessagesList中,它们是它带回的ID字段.就像这样:

messageId = 1 | EncId = 1
messageId = 2 | EncId = 1
messageId = 3 | EncId = 1
messageId = 4 | EncId = 2
messageId = 5 | EncId = 3

对于所有带有EncId的消息,如果EncId相同(就像所有等于1的EncId一样),则需要在新的嵌套转发器中将它们组合在一起.对于彼此的唯一EncId,我需要创建一个新的嵌套转发器,以便输出看起来像下面的内容.




My issue is that need to add nested rows to this repeater.

In my MessagesList their is an ID field that it brings back. So it would something like:

messageId = 1 | EncId = 1
messageId = 2 | EncId = 1
messageId = 3 | EncId = 1
messageId = 4 | EncId = 2
messageId = 5 | EncId = 3

For all messages with an EncId, if the EncId''s are the same (like all EncId''s that equal 1), I need to group them together in a new nested repeater. For each other unique EncId I need to create a new nested repeater so the output would look like something below.

FROM | SUBJECT |    DATE
JDoe    Hey       2.2.2011
Steve   Meeting   2.4.2011
George --> This would be a new repeater a this line would be the header row
        "This would be the subject for messageId = 1 | EncId = 1"     2.5.2011
        "This would be the subject for messageId = 2 | EncId = 1"    2.5.2011
        "This would be the subject for messageId = 3 | EncId = 1"    2.5.2011
Rick    Hey2       2.2.2011
John    Maintenence  2.4.2011
Alex --> This would be a new repeater a this line would be the header row
        "This would be the subject for messageId = 4 | EncId = 2"     2.5.2011
Bill   Test Subject 2.6.2011
Harris   Test   3.9.2010
Alex --> This would be a new repeater a this line would be the header row
         This would be the subject for messageId = 5 | EncId = 3     2.5.2011



有人可以帮我解决这个问题吗?



Can somebody help me with how I can do this???

推荐答案

嗨 基本上,您需要在项目模板中嵌套另一个转发器.
然后将OnItemDataBound事件添加到外部转发器,然后将数据绑定到嵌套的转发器.
此处是带有示例的好文章
Hi basically, you need to nest another repeater in the item template.
then you add a OnItemDataBound event to the outside repeater, and bind your data to the nested repeater.
heres a good article with examples


http://weblogs.sqlteam.com/jeffs/archive/2007/11 /02/parent-child-datatable-nested-repeaters.aspx



这篇文章最终解决了我的问题...谢谢!
http://weblogs.sqlteam.com/jeffs/archive/2007/11/02/parent-child-datatable-nested-repeaters.aspx



This article ended up solving my problem...thanks!


这篇关于多个嵌套中继器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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