Fares Ayyad

Fares Ayyad

  • NA
  • 235
  • 74.2k

Implementing nested repeater with accordion asp.net C# ?

Nov 8 2016 1:58 PM

Hello
 
I'm trying to code nested repeater to show two kind of information
 
first repeater will show a table wit some information
 
the first column will have a link, if user clicks on the link accordion will slide down
 
with a new table with new information.
 
my issue here is how to make the second repeater recognizable by code, and the second issue is how to give append data for the second repeater based on the first one ?
 
can any one guide me how to show information in a table then show another related information under the first table as accordion, keep in mind that two data will be retrieved from database.
 
 
 
this is the code that doesn't completed :(
.aspx page code:
  1. <asp:Repeater ID="rptDep"  runat="server"  >  
  2.               <HeaderTemplate>  
  3.                   <table class="table table-hover table-striped table-condensed table-bordered table-responsive">  
  4.                     
  5.                        <tr>  
  6.                        <th>Deposit No.</th>  
  7.                        <th>Custom Declaration No.</th>   
  8.                        <th>Category</th>  
  9.                        <th>Location</th>  
  10.                        <th>Goods Description</th>  
  11.                        <th>Units Balance</th>  
  12.                        <th>WT Balance</th>  
  13.                        <th>Goods Balance Amount(LC)</th>  
  14.                    </tr>  
  15.               </HeaderTemplate>  
  16.   
  17.                <ItemTemplate>  
  18.                      
  19.                       <tr>  
  20.                       <td><a href="#" onclick="getID(<%#Eval("id")%>)">              <%#Eval("depNo")%></a></td>  
  21.                       <td><%#Eval("customDec") %></td>      
  22.                       <td><%#Eval("category") %></td>  
  23.                       <td><%#Eval("location") %></td>  
  24.                       <td><%#Eval("goodDesc") %></td>  
  25.                       <td><%#Eval("unitsBal") %></td>  
  26.                       <td><%#Eval("wtBal") %></td>  
  27.                       <td><%#Eval("lcBal") %></td>    
  28.                            
  29.                    </tr>   
  30.    
  31.             
  32.                </ItemTemplate>  
  33.               
  34.                <FooterTemplate>  
  35.                    </table>  
  36.                </FooterTemplate>  
  37.            </asp:Repeater>  
 this is the .cs code 
 
 
  1. var query = (from cd in db.CDIndexes  
  2.              join com in db.Companies on cd.cdin_CompanyId equals com.Comp_CompanyId  
  3.              join ter in db.Territories on cd.cdin_Secterr equals ter.Terr_TerritoryID  
  4.   
  5.              where cd.cdin_Deleted == null &&  
  6.              com.Comp_Deleted == null &&  
  7.              cd.cdin_Status == "InProgress" &&  
  8.              com.Comp_CompanyId == 408  
  9.              select new  
  10.              {  
  11.                  location=ter.Terr_Caption,  
  12.                  depNo=cd.cdin_Serial,  
  13.                  customDec = cd.cdin_Customdeclar,  
  14.                  category=cd.cdin_category,  
  15.                  goodDesc=cd.cdin_goodsDesc,  
  16.                  unitsBal = cd.cdin_RemainPackages,  
  17.                  wtBal = cd.cdin_RemainWT,  
  18.                  lcBal=cd.cdin_ActMortgageAmnt,  
  19.                  id=cd.cdin_CDIndexID,  
  20.   
  21.              }  
  22.   
  23.            ).ToList();  
  24.   
  25.     rptDep.DataSource = query; // db.CDIndexes.Where(i=>i.cdin_CompanyId == c.Comp_CompanyId && i.cdin_Secterr== t.Terr_TerritoryID && i.cdin_Status== "InProgress" && i.cdin_Deleted ==null).ToList();  
  26.     rptDep.DataBind();  
 
 
if user clicks on number 16
a new table should slide down with information based on  
 
getID(<%#Eval("id")%>)
 
the function that carry out the id of the record. 

Answers (1)