asp.net control repeater description
Create a Repeater control in the. aspx page. The contents of the <HeaderTemplate> element appear only once in the output, and the contents of the <ItemTemplate> element are repeated to the "record" in the DataSet, and finally, the <footertemplate The content of > appears only once in the output.
Add <AlternatingItemTemplate> elements after the <ItemTemplate> element so that you can describe the appearance of alternating rows.
The <SeparatorTemplate> element can be used to describe the separator between each record.
Example:
- <form runat= "Server" >
- <asp:repeater id= "Cdcatalog" runat= "Server" >
- <HeaderTemplate>
- <table border= "1" width= "100%" >
- <tr>
- <th>Title</th>
- <th>Artist</th>
- <th>Country</th>
- <th>Company</th>
- <th>Price</th>
- <th>Year</th>
- </tr>
- </HeaderTemplate>
- <ItemTemplate>
- <tr>
- <td><% #Container. DataItem ("title")%></td>
- <td><% #Container. DataItem ("artist")%></td>
- <td><% #Container. DataItem ("Country")%></td>
- <td><% #Container. DataItem ("Company")%></td>
- <td><% #Container. DataItem ("Price")%></td>
- <td><% #Container. DataItem ("year")%></td>
- </tr>
- </ItemTemplate>
- <AlternatingItemTemplate>
- <tr bgcolor= "#e8e8e8" >
- <td><% #Container. DataItem ("title")%></td>
- <td><% #Container. DataItem ("artist")%></td>
- <td><% #Container. DataItem ("Country")%></td>
- <td><% #Container. DataItem ("Company")%></td>
- <td><% #Container. DataItem ("Price")%></td>
- <td><% #Container. DataItem ("year")%></td>
- </tr>
- </AlternatingItemTemplate>
- <SeparatorTemplate>
- <tr>
- <TD colspan= "6" >
- </tr>
- </SeparatorTemplate>
- <FooterTemplate>
- </table>
- </FooterTemplate>
- </asp:Repeater>