Click here to Skip to main content
11,636,213 members (79,405 online)
Rate this: bad
Please Sign up or sign in to vote.
See more: C# ASP.NET
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

<asp:Repeater ID="repcolor" runat="server" OnItemDataBound="repcolor_OnItemDataBound">
                <table style="border: 1px solid black;">
                            <asp:Repeater ID="hsize" runat="server">
                                    <td style="border: 1px solid black;">
                                        <%# DataBinder.Eval(Container, "DataItem.SValue")%>
                            <td style="border: 1px solid black;">
                <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") %>
                    <asp:Repeater ID="tsize" runat="server" OnItemDataBound="tsize_OnItemDataBound">
                            <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 style="border: 1px solid black;">
                        <asp:TextBox ID="total" runat="server" class="total" ReadOnly="true" Style="width: 50px;"></asp:TextBox>
Posted 2-Sep-12 6:52am
Ed Nutting at 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,

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

  Print Answers RSS
0 295
1 Sergey Alexandrovich Kryukov 275
2 OriginalGriff 233
3 Suvendu Shekhar Giri 225
4 stibee 215
0 OriginalGriff 8,941
1 Sergey Alexandrovich Kryukov 8,459
2 Mika Wendelius 6,849
3 F-ES Sitecore 2,364
4 Suvendu Shekhar Giri 2,320

Advertise | Privacy | Mobile
Web04 | 2.8.150728.1 | Last Updated 2 Sep 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100