嗨我有一个3层嵌套转发器,我需要在回发下面的转发器condRptr中访问值,我尝试了一切但似乎无法到达任何地方。我最初在转发器中使用了标头模板中的runat服务器,但这引起了错误。
任何人有任何想法吗?
<asp:Repeater ID="deptRepeater" runat="server" OnItemDataBound="bindDepts">
<HeaderTemplate>
</HeaderTemplate>
<ItemTemplate>
<div id="itemContainer">
<h3 class="fdAccordionHeader"><%# Eval("desc") %><span class="fdAccordionHeaderIcon"></span></h3><asp:HiddenField ID="deptid" runat="server" Value='<%# Eval("dept_id") %>' />
<div class="fdAccordionContent" style="display:none">
<asp:Repeater ID="prodRepeater" runat="server" OnItemCommand="itemToCart">
<HeaderTemplate>
</HeaderTemplate>
<ItemTemplate>
<div>
<h4 class="fdProductHeader"><span class="fdProductHeaderTitle"><%# Eval("desc") %></span><span class="fdProductFeatured"></span><span class="fdProductHeaderPrice">€<%# Eval("price") %></span><span class="fdClearBoth"></span></h4>
<div class="fdProductContent" style="display:none">
<img class="fdProductImage" src="http://wingit.ie/script/app/web/img/frontend/noimg.png" alt="">
<div class="fdProductContentRight">
<div class="fdProductDesc">A helping of our delicious wings, served with fries and a drink of your choice. Perfect if you're particularly hungry!</div>
<input type="hidden" name="product_id" value="2">
<!--<a href="#" class="fdButton fdButtonOrder"></a>-->
<asp:LinkButton ID="btnOrder" runat="server" CssClass="fdButton fdButtonOrder" CommandName="addToCart" CommandArgument='<%# Eval("product") %>' ></asp:LinkButton>
<table id="condimentsContainer" cellpadding="0" cellspacing="0" runat="server">
<asp:Repeater ID="condRptr" runat="server">
<ItemTemplate>
<tr><td>
<table id='condiments' cellpadding="0" cellspacing="0" class="fdProductExtraTbl" runat="server">
<tbody>
<tr>
<td><%# Eval("pDesc") %></td>
<td class="fdProductExtraTblPrice"><asp:Label ID="priceLvl" runat="server">€<%# Eval("pPrice") %> x</asp:Label>
<input id="modifier" class="modifier" type="text" name="extra_id[3]" value="0" runat="server"/>
<input id="hdProd" type="hidden" value='<%# Eval("pCode") %>' runat="server"/>
</td>
<td class="fdProductExtraTblIco"><a href="#" data-eid="3" data-pid="2" class="fdProductExtraIcon fdProductExtraIconPlus"></a></td>
<td class="fdProductExtraTblIco"><a href="#" data-eid="3" data-pid="2" class="fdProductExtraIcon fdProductExtraIconMinus"></a></td>
</tr>
</tbody>
</table>
</td></tr>
</ItemTemplate>
</asp:Repeater>
</table>
</div>
<span class="fdClearLeft"></span>
</div>
</div>
</ItemTemplate>
<FooterTemplate>
</FooterTemplate>
</asp:Repeater>
</div>
</div>
</ItemTemplate>
<FooterTemplate>
</FooterTemplate>
</asp:Repeater>
答案 0 :(得分:0)
好吧,因为没有人有任何想法;)我最终想出了一个漂亮的工作,因为我不能在标题模板中有runat服务器,我基本上把它放在 像这样的元素
<tr ID="dataRow" runat="server"> rest of data </tr>
然后在服务器端的C#代码中,我能够使用RepeatEreventArgs并将其转换为HtmlTableRow,以便我可以遍历数据 - 简单:)