在另一个中继器标签中使用中继器 [英] using repeater in another repeater tag

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

问题描述

我有一个中继器,它显示类别列表(我在数据库中有),我在该中继器中还有另一个中继器,该中继器显示了与我的数据库中的类别相关的项目,类别中继器可以正常工作,但是这就是我想做:
category1 => item1_category1,item2_category1,item3_category1,....
category2 => item1_category2,item2_category2,item3_category2,....
........
如我所说,类别列表没有问题,但我不知道该为项目列表做什么.
在正常情况下,如果我想使用sql命令,则应使用从db where category = @ category中选择项目",但在这种情况下,@ category通过Repeater(category Repeater)进行更改
任何的想法 ?!!!!!!!
预先感谢

i have a repeater which shows the list of categories ( which i have in database ) , i have another repeater inside this repeater which shows the items related to the category from my db, the category repeater works fine , but this is what i want to do :
category1=>item1_category1, item2_category1, item3_category1 , ....
category2=>item1_category2, item2_category2, item3_category2, ....
........
as i said , there is no problem in category list, but i dont know what should i do for the items list.
in a normal situation if i want to use a sql command i should use " select item from db where category=@category" but in this situation @category changes through the repeater( category repeater)
any idea ?!!!!!!!
thanks in advance

推荐答案

您要使用onitemdatabound事件在代码中查找内部转发器.此时,您可以访问所在的行,因此将需要了解子查询的数据存储在该行中,然后运行代码以分配数据源.
You want to use the onitemdatabound event to find the inner repeater in code. At that point, you can access the row that you''re in, so store in that row the data you need to know the sub query, and then run the code to assign a data source.


赛义德,

将有2个中继器.第一个类别,另一个用于项目.
现在,将类别项目中继器"放入类别中继器"的项目模板中,并将类别ID保存到隐藏"字段中.
现在,您可以将Category Item Repeater绑定到主Category Repeater的ItemDatabound事件中.
在这里,您可以使用查找隐藏字段"值方法找到主类别中继器的类别ID.您可以在此处绑定另一个中继器.

谢谢,
Viprat
Hi Saeed,

There will be 2 Repeater. 1st for category and another for items.
Now Put Category Item Repeater into Category repeater`s item template and save the category id into Hidden field.
Now you can bound Category Item Repeater into the ItemDatabound event of main Category repeater.
Here you will find the category id of main Category Repater using find hidden field value method.and you can bind here your another repeater.

Thanks,
Viprat


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

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