日期:2014-05-18  浏览次数:20981 次

Repeater嵌套Repeater取子Repeater值并GET传递
C# code

<asp:Repeater ID="Repeater1" runat="server" onitemdatabound="Repeater1_ItemDataBound"><ItemTemplate>
<%#XPath("Price")%>
<asp:Button ID="Button1" runat="server" CssClass="bok" Text="跳转"/>
<asp:Repeater ID="Repeater2" runat="server"><ItemTemplate>
<%#XPath("deptime")%><%#XPath("arrtime")%>
</ItemTemplate></asp:Repeater>
</ItemTemplate></asp:Repeater>



我点击父Repeater中的Button时,用什么办法可以把父Repeater中的Price和整个子Repeater的数所GET到另一个页面,谢谢!

------解决方案--------------------
获取Price:(Repeater1.Items[i].Controls[0] as LiteralControl).Text

Repeater repeater2=Repeater1.Items[i].FindControl("Repeater2") as Repeater;
在对repeater2的items循环,获取其中的值。类似于获取Price。