<%@ Page Language=VB Debug=true %>
<%@ Import Namespace="System.Data" %>
<script runat=server>
Private MyDT As New DataTable
Sub Page_Load(ByVal Sender as Object, ByVal E as EventArgs)
Dim MyRow As DataRow
MyDT.Columns.Add(New DataColumn("EmployeeID", _
GetType(Int32)))
MyDT.Columns.Add(New DataColumn("EmployeeFirstName", _
GetType(String)))
MyDT.Columns.Add(New DataColumn("EmployeeLastName", _
GetType(String)))
MyDT.Columns.Add(New DataColumn("BirthDate", _
GetType(Date)))
MyDT.Columns.Add(New DataColumn("Salary", _
GetType(Single)))
MyRow = MyDT.NewRow()
MyRow(0) = 1
MyRow(1) = "Bob"
MyRow(2) = "Miller"
MyRow(3) = "5/15/65"
MyRow(4) = "40000"
MyDT.Rows.Add(MyRow)
MyRow = MyDT.NewRow()
MyRow(0) = 2
MyRow(1) = "Jenny"
MyRow(2) = "Fry"
MyRow(3) = "7/22/75"
MyRow(4) = "73050"
MyDT.Rows.Add(MyRow)
MyRow = MyDT.NewRow()
MyRow(0) = 3
MyRow(1) = "Lisa"
MyRow(2) = "Smith"
MyRow(3) = "12/8/71"
MyRow(4) = "62500"
MyDT.Rows.Add(MyRow)
MyRow = MyDT.NewRow()
MyRow(0) = 4
MyRow(1) = "Stephanie"
MyRow(2) = "Myer"
MyRow(3) = "3/15/54"
MyRow(4) = "43222"
MyDT.Rows.Add(MyRow)
MyRow = MyDT.NewRow()
MyRow(0) = 5
MyRow(1) = "Jimmy"
MyRow(2) = "Parker"
MyRow(3) = "3/12/47"
MyRow(4) = "52825"
MyDT.Rows.Add(MyRow)
rpt1.DataSource = MyDT
rpt1.DataBind()
End Sub
</SCRIPT>
<HTML>
<HEAD>
<TITLE>Repeater Control Sample Page</TITLE>
</HEAD>
<BODY >
<form runat="server">
<Font Face="Tahoma">
<ASP:Repeater
id="rpt1"
runat="server"
>
<HeaderTemplate>
<Table width="100%" style="font: 8pt verdana">
<TR style="Background-Color:DFECD8">
<TD><B>Employee ID</B></TD>
<TD><B>First Name</B></TD>
<TD><B>Last Name</B></TD>
<TD><B>Birth Date</B></TD>
<TD><B>Salary</B></TD>
</TR>
</HeaderTemplate>
<ItemTemplate>
<TR style="Background-Color:FFECD9">
<TD>
<%# DataBinder.Eval(Container.DataItem, "EmployeeID") %>
</TD>
<TD>
<%# DataBinder.Eval(Container.DataItem, "EmployeeFirstName") %>
</TD>
<TD>
<%# DataBinder.Eval(Container.DataItem, "EmployeeLastName") %>
</TD>
<TD>
<%# Format(DataBinder.Eval(Container.DataItem, "BirthDate"), "Short Date") %>
</TD>
<TD>
<%# FormatCurrency(DataBinder.Eval(Container.DataItem, "Salary")) %>
</TD>
</TR>
</ItemTemplate>
<AlternatingItemTemplate>
<TR style="Background-Color:FFECA8">
<TD>
<%# DataBinder.Eval(Container.DataItem, "EmployeeID") %>
</TD>
<TD>
<%# DataBinder.Eval(Container.DataItem, "EmployeeFirstName") %>
</TD>
<TD>
<%# DataBinder.Eval(Container.DataItem, "EmployeeLastName") %>
</TD>
<TD>
<%# Format(DataBinder.Eval(Container.DataItem, "BirthDate"), "Short Date") %>
</TD>
<TD>
<%# FormatCurrency(DataBinder.Eval(Container.DataItem, "Salary")) %>
</TD>
</TR>
</AlternatingItemTemplate>
<SeparatorTemplate>
<TR style="Background-Color:White">
<TD> </TD>
<TD> </TD>
<TD> </TD>
<TD> </TD>
<TD> </TD>
</TR>
</SeparatorTemplate>
<FooterTemplate>
<TR style="Background-Color:DFECD8">
<TD><B>Employee ID</B></TD>
<TD><B>First Name</B></TD>
<TD><B>Last Name</B></TD>
<TD><B>Birth Date</B></TD>
<TD><B>Salary</B></TD>
</TR>
</Table>
</FooterTemplate>
</ASP:Repeater>
</Font>
</Form>
</BODY>
</HTML>
|