readXml

landerson

New member
Joined
Aug 30, 2007
Messages
1
Programming Experience
Beginner
RESOLVED - readXml

nevermind i was able to get it to work... thanks anyways

I am pretty new at this - I am trying to read an xml file and use it in a repeater control. I was having problems with it and I found an example online. I can not seem to get the example to work either. I am not getting an errors, but no data is printing out.

Here is what is in the .aspx
VB.NET:
<%@ 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>

VB.NET:
<form id="Form1" 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>

<FooterTemplate>
</table>
</FooterTemplate>

</asp:Repeater>
</form>

Any suggestions on what might be wrong? If I switch to the design view I can see the table and all the databound fields, but when I run it, nothing is showing up.
 
Last edited:
change the line
VB.NET:
sub Page_Load
to
VB.NET:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
 
Back
Top