ASP.NET(vb.net) & Read XML and DataBind - The in this article we will show example scripts ASP.NET how to read XML and databind.
ShotDev Focus:
- ASP.NET(vb.net) & Read XML and DataBind
Example
AspNetReadXml.aspx
<%@ Import Namespace="System.Data"%> <%@ Page Language="VB" %> <script runat="server"> Sub Page_Load(sender As Object, e As EventArgs) Dim ds As New DataSet ds.ReadXml(MapPath("XML/customer.xml")) '*** BindData to Repeater ***' myRepeater.DataSource = ds myRepeater.DataBind() End Sub </script> <html> <head> <title>ShotDev.Com Tutorial</title> </head> <body> <form id="form1" runat="server"> <asp:Repeater id="myRepeater" runat="server"> <HeaderTemplate> <table border="1"> <tr> <th>CustomerID</th> <th>Name</th> <th>Email</th> <th>CountryCode</th> <th>Budget</th> <th>Used</th> </tr> </HeaderTemplate> <ItemTemplate> <tr> <td align="center"><%#Container.DataItem("CustomerID") %></td> <td><%#Container.DataItem("Name") %></td> <td><%#Container.DataItem("Email") %></td> <td align="center"><%#Container.DataItem("CountryCode") %></td> <td align="right"><%#Container.DataItem("Budget") %></td> <td align="right"><%#Container.DataItem("Used") %></td> </tr> </ItemTemplate> <FooterTemplate> <!-- <tr> <th>CustomerID</th> <th>Name</th> <th>Email</th> <th>CountryCode</th> <th>Budget</th> <th>Used</th> </tr> --> </table> </FooterTemplate> </asp:Repeater> </form> </body> </html>
Screenshot