Slide 14.10: The Repeater control (cont.)
Slide 15.1: The World Wide Web
Home

The Repeater Control (Cont.)


Using the SeparatorTemplate Property
The SeparatorTemplate element can be used to describe a separator between each record. The following example inserts a horizontal line between each table row.

Related examples can be found at ASP.NET Quickstart.


demo_repeater3.aspx

Web
<%@ Page Language="VB" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<%@ Import Namespace="System.Data" %>
<script language="VB" runat="server">
 Sub Page_Load(s As Object, e As EventArgs) Handles Me.Load
  If Not Page.IsPostBack then
   dim mycdcatalog = New DataSet
   mycdcatalog.ReadXml( MapPath( "cdcatalog.xml" ) )
   cdcatalog.DataSource = mycdcatalog
   cdcatalog.DataBind( )
  End If
 End Sub
</script>

<html xmlns="http://www.w3.org/1999/xhtml" > 
 <body> 
  <form runat="server">
   <asp:Repeater id="cdcatalog" runat="server">
    <HeaderTemplate>
     <table border="0" width="100%">
      <tr>
       <th align="left">Title</th>
       <th align="left">Artist</th>
       <th align="left">Company</th>
       <th align="left">Price</th>
      </tr>
    </HeaderTemplate>
    <ItemTemplate>
      <tr>
       <td><%#Container.DataItem("title")%></td>
       <td><%#Container.DataItem("artist")%></td>
       <td><%#Container.DataItem("company")%></td>
       <td><%#Container.DataItem("price")%></td>
      </tr>
    </ItemTemplate>
    <SeparatorTemplate>
      <tr>
       <td colspan="6"><hr /></td>
      </tr>
    </SeparatorTemplate>
    <FooterTemplate>
     </table>
    </FooterTemplate>
   </asp:Repeater>
  </form>
 </body>
</html>