取得Repeter中數據項,如TR

aspx頁:
< asp:Repeater  id ="Repeater1"  runat ="server" >
 
< HeaderTemplate >
    
< table  border ="1" >
       
< tr >
          
< td >< b > Item </ b ></ td >
          
< td >< b > Price </ b ></ td >
       
</ tr >
 
</ HeaderTemplate >
 
< ItemTemplate >
    
< tr  runat ="server"  id ="rows" >
       
< td >   <% # Eval ( " Item " %>   </ td >
       
< td >   <% # Eval ( " Price " %>   </ td >
    
</ tr >
 
</ ItemTemplate >
 
< FooterTemplate >
    
</ table >
 
</ FooterTemplate >
</ asp:Repeater >
aspx.cs頁:
foreach (RepeaterItem item  in  Repeater1.Items)
{
    HtmlTableRow tr 
=  (HtmlTableRow)item.FindControl( " rows " );
    
foreach  (HtmlTableCell td  in  tr.Cells)
    {
        Response.Write(td.InnerHtml);
    }
}

你可能感兴趣的:(tr)