Search code examples
c#asp.netwebformsaccordionrepeater

Implement accordion within table and asp:repeater


I create table inside a repeater and the data appears correctly, it will be two records looks like in the image below.

enter image description here what i want: how to make accordion when user clicks on the deposit number(Example 16), new table will appear and contain data.

this is the repeater the first repeater code:

<asp:Repeater ID="rptDep"  runat="server"  >
    <HeaderTemplate>
        <table class="table table-hover table-striped table-condensed table-bordered table-responsive">
            <tr>
                <th>Deposit No.</th>
                <th>Custom Declaration No.</th> 
                <th>Category</th>
                <th>Location</th>
                <th>Goods Description</th>
                <th>Units Balance</th>
                <th>WT Balance</th>
                <th>Goods Balance Amount(LC)</th>
            </tr>
    </HeaderTemplate>
    <ItemTemplate>
        <tr>
            <td><a href="#">  <%#Eval("depNo") %></a></td>
            <td><%#Eval("customDec") %></td>    
            <td><%#Eval("category") %></td>
            <td><%#Eval("location") %></td>
            <td><%#Eval("goodDesc") %></td>
            <td><%#Eval("unitsBal") %></td>
            <td><%#Eval("wtBal") %></td>
            <td><%#Eval("lcBal") %></td>                  
        </tr> 
    </ItemTemplate>
    <FooterTemplate>
        </table>
    </FooterTemplate>
</asp:Repeater>

I know that it will be a second repeater, but how to implement that, or how to use foreach statement?


Solution

  • I got it, I found the solution by reading this article:

    Implement Nested Repeater (Repeater inside Repeater) with example in ASP.Net using C# and VB.Net