Question

Hi i have a 3 tiered nested repeater and i need to access the values in the repeater condRptr below on postback, i tried everything but dont seem to be able to get anywhere. I had the table originally within the repeater with runat server in the header template but this threw an error.

Anyone got any ideas??

<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>
Was it helpful?

Solution

Ok so as no-one had any ideas ;) i eventually figured out a nifty work around for this, because i couldn't have the runat server in the header template, i basically put it in the element like so

<tr ID="dataRow" runat="server"> rest of data </tr>

Then in the C# code on the server side i was able to use the RepeatEreventArgs and cast the as a HtmlTableRow so that i could iterate through the data - simples :)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top