菜单切换
FACESOHO知行者
心灵
记录
远方
源代码:
保存
点击运行
<%@ Import Namespace="System.Data" %>
<script runat="server"> sub Page_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>
<!DOCTYPE html> <html> <body> <form runat="server"> <asp:Repeater id="cdcatalog" runat="server"> <HeaderTemplate> <table border="1" width="100%"> <tr> <th>Title</th> <th>Artist</th> <th>Company</th> <th>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> <AlternatingItemTemplate> <tr bgcolor="#e8e8e8"> <td>
<%#Container.DataItem("title")%>
</td> <td>
<%#Container.DataItem("artist")%>
</td> <td>
<%#Container.DataItem("company")%>
</td> <td>
<%#Container.DataItem("price")%>
</td> </tr> </AlternatingItemTemplate> <FooterTemplate> </table> </FooterTemplate> </asp:Repeater> </form> </html> </body>
运行结果
Title
Artist
Company
Price
Empire Burlesque
Bob Dylan
Columbia
10.90
Hide your heart
Bonnie Tyler
CBS Records
9.90
Greatest Hits
Dolly Parton
RCA
9.90
Still got the blues
Gary Moore
Virgin records
10.20
Eros
Eros Ramazzotti
BMG
9.90