Hi,

I have the code here as in the following:

<%@ Import Namespace="System.Data" %>
<%@ Page Language="C#" Debug="true" %>

<script  runat="server">
sub Page_Load
if Not Page.IsPostBack then
   dim mycdcatalog=New DataSet
   mycdcatalog.ReadXml(MapPath("alice_music_list.xml"))
   cdcatalog.DataSource= mycdcatalog
   cdcatalog.DataBind()
end if
end sub
</script>

<html>
<body>

<form runat="server">
<asp:Repeater id="cdcatalog" runat="server">

<HeaderTemplate>
<table style=";font-family:Arial;width:56%;margin:1em 5% 5% 1em" border="1">
<tr style="background-color:black;color:white">
<th align="left">Title</th>
<th align="left">Date Added</th>
</tr>
</HeaderTemplate>

<ItemTemplate>                                        
  <tr style="background-color:#FFFFCC;color:red">
<td><%#Container.DataItem("title")%> </td>
<td>
 <asp:Repeater ID="Repeater_a" DataSource="<%#XPathSelect("song/date")%>"
  <ItemTemplate><%#XPath("@added")%></ItemTemplate>
</td> 
</tr>
</ItemTemplate>

<SeparatorTemplate>
<tr>
<td colspan="3"></td>
</tr>
</SeparatorTemplate>

<FooterTemplate>
</table>
</FooterTemplate>

</asp:Repeater>
</form>
</body>
</html>

However, this is what I get:

Compiler Error Message: CS1002: ; expected
c:\inetpub\wwwroot\cd_collection\separator_client.aspx(6,14): error CS1002: ; expected
c:\inetpub\wwwroot\cd_collection\separator_client.aspx(7,1): error CS1519: Invalid token 'if' in class, struct, or interface member declaration
c:\inetpub\wwwroot\cd_collection\separator_client.aspx(7,12): error CS1002: ; expected
c:\inetpub\wwwroot\cd_collection\separator_client.aspx(7,28): error CS1002: ; expected
c:\inetpub\wwwroot\cd_collection\separator_client.aspx(8,24): error CS1002: ; expected
c:\inetpub\wwwroot\cd_collection\separator_client.aspx(9,31): error CS1001: Identifier expected
c:\inetpub\wwwroot\cd_collection\separator_client.aspx(10,24): error CS1519: Invalid token '=' in class, struct, or interface member declaration
c:\inetpub\wwwroot\cd_collection\separator_client.aspx(11,24): error CS1002: ; expected
c:\inetpub\wwwroot\cd_collection\separator_client.aspx(12,5): error CS1519: Invalid token 'if' in class, struct, or interface member declaration
c:\Windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\26676eb7\92c7e946\App_Web_ao07id8k.0.cs(141,9): error CS0650: Syntax error, bad array declarator. To declare a managed array the rank specifier precedes the variable's identifier. To declare a fixed size buffer field, use the fixed keyword before the field type.
c:\Windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\26676eb7\92c7e946\App_Web_ao07id8k.0.cs(141,10): error CS0270: Array size cannot be specified in a variable declaration (try initializing with a 'new' expression)
c:\Windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\26676eb7\92c7e946\App_Web_ao07id8k.0.cs(141,60): error CS1002: ; expected

Have I done something wrong here?
I tried some other apps and it does execute properly.

Thanks for your help.

Recommended Answers

All 2 Replies

<asp:Repeater ID="Repeater1" runat="server" DataSourceID="XmlDataSource1">
        <ItemTemplate>        
                <p>
                    <%# XPath("Name") %> - <%# XPath("Surname") %>
                </p>        
        </ItemTemplate>
        </asp:Repeater>
        <asp:XmlDataSource ID="XmlDataSource1" runat="server" DataFile="~/file.xml" XPath="//Person"></asp:XmlDataSource>

also refer to this..
http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.xmldatasource.xpath.aspx

Thanks, I just found out I also need to take out the subroutine at the beginning of the script, or it would not work.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.