Click here to Skip to main content
Rate this: bad
good
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">
            <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 2-Sep-12 7:52am
Comments
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,
Ed

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

  Print Answers RSS
0 OriginalGriff 365
1 Sergey Alexandrovich Kryukov 329
2 CPallini 270
3 Afzaal Ahmad Zeeshan 204
4 DamithSL 194
0 OriginalGriff 5,515
1 DamithSL 4,451
2 Maciej Los 3,902
3 Kornfeld Eliyahu Peter 3,480
4 Sergey Alexandrovich Kryukov 3,175


Advertise | Privacy | Mobile
Web03 | 2.8.141216.1 | Last Updated 2 Sep 2012
Copyright © CodeProject, 1999-2014
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