Click here to Skip to main content
15,888,195 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear Memebers,

Here is my code, I need to access inner repeater and textbox inside the inner repeater of itemtemplate of parent repeater, through code behind or javascript,
Please help me out


XML
<asp:Repeater ID="repcolor" runat="server" OnItemDataBound="repcolor_OnItemDataBound">
            <HeaderTemplate>
                <table style="border: 1px solid black;">
                    <thead>
                        <tr>
                            <td>
                                Color
                            </td>
                            <asp:Repeater ID="hsize" runat="server">
                                <ItemTemplate>
                                    <td style="border: 1px solid black;">
                                        <%# DataBinder.Eval(Container, "DataItem.SValue")%>
                                    </td>
                                </ItemTemplate>
                            </asp:Repeater>
                            <td style="border: 1px solid black;">
                                Total
                            </td>
                        </tr>
                    </thead>
            </HeaderTemplate>
            <ItemTemplate>
                <tr style="border: 1px solid black;" id="tr_tsize">
                    <td style="border: 1px solid black;">
                        <asp:Label ID="lblColorID" Style="display: none;" runat="server" Text='<%#Eval("ID") %>'></asp:Label>
                        <%# DataBinder.Eval(Container, "DataItem.Name") %>
                    </td>
                    <asp:Repeater ID="tsize" runat="server" OnItemDataBound="tsize_OnItemDataBound">
                        <ItemTemplate>
                            <td style="border: 1px solid black;">
                                <asp:Label ID="lblSizeID" Style="display: none;" runat="server" Text='<%#Eval("ID") %>'></asp:Label>
                                <asp:TextBox ID="id" runat="server" class="box" Style="width: 50px;"></asp:TextBox>
                            </td>
                        </ItemTemplate>
                    </asp:Repeater>
                    <td style="border: 1px solid black;">
                        <asp:TextBox ID="total" runat="server" class="total" ReadOnly="true" Style="width: 50px;"></asp:TextBox>
                    </td>
                </tr>
            </ItemTemplate>
            <FooterTemplate>
                </table>
            </FooterTemplate>
        </asp:Repeater>
Posted
Comments
Ed Nutting 2-Sep-12 14:50pm    
As far as I was aware, by the time the code is rendered to the web browser (i.e. actual HTML is outputted) the repeater etc. have been converted to actual HTML elements and there is no further trace of them. Try using a web debugger to look at the actual HTML rendered to the web browser - that will show you what to do in JavaScript. As for code behind, what's wrong with accessing the inner repeater by Id? What do you mean by "access"? If you need "access" to individual items then that is done via your data not directly through the repeater surely? Or if you mean "access" as in changing the look of what the repeater renders dynamically, then "access" it via Id server side. I.e. tsize.some_property = ....

Hope this helps a little, though it would be helpful to know what you are actually trying to do/achieve,
Ed

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900