nested-repeater

Accessing parent data in nested repeater, in the HeaderTemplate

亡梦爱人 提交于 2019-11-26 10:56:59
问题 Simple question, not sure there\'s a simple answer! So here\'s the code: (I\'ve simplified it a lot to make it easier to read) <asp:Repeater runat=\"server> <ItemTemplate> <asp:Repeater runat=\"server\"> <HeaderTemplate> <h1>My header here for: <%# OuterContainer.DataItem.MyItemName %> </h1> </HeaderTemplate> <ItemTemplate> My items code here </ItemTemplate> </asp:Repeater> </ItemTemplate> </asp:Repeater> How, in the HeaderTemplate - can I access the DataItem in the parent repeater? 回答1: I

Repeater in Repeater

淺唱寂寞╮ 提交于 2019-11-26 07:33:08
问题 I have a repeater inside a repeater. Where the parent repeater is bound to a Datatble which has a column with a Datatable in it. I would like to bind the child repeater to the datatable column in the parent repeater\'s datarow Is this possible? i was thinking i could do this directly in the aspx file like: DataSource=\"<%# DataBinder.Eval(Container.DataItem, \"Products\")%>\" but it doesn\'t seem to work. 回答1: In the parent repeater, attach a method to the OnItemDataBound event and in the