ASP.NET 3级嵌套的中继器 [英] ASP.NET 3 level of nested repeater

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

问题描述

我想从一个数据库的表中做3级嵌套的中继器。我有持有的问题组和问题群体的问题举行一个类别。

I want to do 3 level of nested repeater from tables of a database. I have a Category that hold Groups of questions and groups of questions hold questions.

很想有我如何能实现这一方案中的小例子。

Would love to have a little example on how i can realize this scenario.

2级中继器并不难,但是当它来到3级另一个故事...

2 level of repeater is not that hard but when it come to 3 level that another story...

请注意:我使用ASP.NET Web表单。拜托,我不希望有数据集或数据表的例子。

Note: I am using ASP.NET Webforms. Please, i don't want an example with DataSet or DataTable.

谢谢!

推荐答案

我preFER做手工重复控制以消除DB调用的嵌套。

I prefer to do nesting of repeating controls manually to eliminate DB calls.

做3 DB调用来获得所有级别的数据。第一个电话让您的主数据。第二个电话让所有所有主记录可能的数据。第三个电话从第二调用的结果让所有的子数据的可能。

Do 3 DB calls to get all your level data. First call get your master data. Second call get all the possible data for all the master records. Third call get all the child data possible from the second calls results.

然后,所有存储在一个全局可访问的变量。实现每个嵌套的中继器的 OnDataBinding 。对于每个 OnDataBinding 事件决绝的关键和嵌套数据进行过滤,并将其绑定。

Then store that all in a globally accessible variable. Implement the OnDataBinding of each nested repeater. For each OnDataBinding event pull off the 'key' and perform a filter on the nested data and bind it.

例如:

DataSet1 - Master data
DataSet2 - All possible child data for DataSet1
DataSet3 - All possible child data for DataSet2

Repeater1 - Bind to DataSet1
Repeater2 - OnDataBinding bind the filtered DataSet2 based on DataSet1 current key
Repeater3 - OnDataBinding bind the filtered DataSet3 based on DataSet2 current key

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

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