在ASP .NET中如何相互使用三个中继器? [英] In ASP .NET how to used three repeater inside with each other..?
本文介绍了在ASP .NET中如何相互使用三个中继器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已经在里面添加了三个中继器,然后如何在子中继器中访问数据项父中继器..
i have added three repeater inside with each other and then how to access Data Item parent Repeater in Child Repeater..
推荐答案
像这样的东西:
Something Like this:
<HeaderTemplate>
<%# ((RepeaterItem)Container.Parent.Parent).DataItem %>
</HeaderTemplate>
获取它在里面的转发器(Rp2)( Rp1)通过以下方式访问Rp2项目:
for(int i = 0; i< rp1.items.count; i ++)>
{
Repeater Rp2 =((Repeater)Rp1.Items [i] .FindControl(Rp2));
/ /然后循环Rp2
for(int j = 0; j< rp2.it ems.count; j ++)>
{
TextBox txtname =((TextBox)Rp2.Items [j] .FindControl(txtname)); //转发器内的文本框2
}
}
to get the repeater ( Rp2 ) it is inside (Rp1) to access the Rp2 items by :
for(int i=0;i<rp1.items.count;i++)>
{
Repeater Rp2= ((Repeater)Rp1.Items[i].FindControl("Rp2"));
//then loop Rp2
for(int j=0;j<rp2.items.count;j++)>
{
TextBox txtname = ((TextBox)Rp2.Items[j].FindControl("txtname")); // textbox inside repeater2
}
}
这篇关于在ASP .NET中如何相互使用三个中继器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文