我想从数据库的表中执行 3 级嵌套转发器。我有一个类别,包含问题组,问题组包含问题。
希望有一个小例子来说明我如何实现这种情况。
2级中继器并不难,但是当谈到3级时,另一个故事......
注意:我正在使用 ASP.NET Webforms。拜托,我不需要 DataSet 或 DataTable 的示例。
Thanks!
我更喜欢手动嵌套重复控件以消除数据库调用。
执行 3 次 DB 调用以获取所有关卡数据。首先致电获取您的主数据。第二次调用获取所有主记录的所有可能数据。第三次调用从第二次调用结果中获取所有可能的子数据。
然后将其全部存储在全局可访问的变量中。实施OnDataBinding
每个嵌套中继器的。对于每个OnDataBinding
事件拉出“键”并对嵌套数据执行过滤并绑定它。
Eg:
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
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)