简单教程
提交运行
代码编辑器:
<%@ 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> <meta charset="utf-8" /> <form runat="server"> <asp:DataList id="cdcatalog" gridlines="both" runat="server"> <HeaderTemplate> My CD Catalog </HeaderTemplate> <ItemTemplate> "<%#Container.DataItem("title")%>" of <%#Container.DataItem("artist")%> - $<%#Container.DataItem("price")%> </ItemTemplate> <FooterTemplate> Copyright Hege Refsnes </FooterTemplate> </asp:DataList> </form>
运行结果: