Hi, Can you use an XML Datasource in Code behind (say in the page load event) to bind to a repeater control? I try the code below but nothing shows up when I run the page
This is the code behind:
if (!Page.IsPostBack)
{
XmlDataSource xds = new XmlDataSource();
xds.DataFile = "~/App_Data/test.xml";
xds.XPath = "/NewDataSet/Customers[CustomerID = 'ALFKI']/Orders[Freight > 30]";
repeaterXML.DataSource = xds;
}
and this is the source:
<asp:Repeater ID="repeaterXML" runat="server">
<HeaderTemplate><table><tr><td>Hello World</td></tr></HeaderTemplate>
<ItemTemplate><tr><td><%# DataBinder.Eval(Container.DataItem,"Freight") %></td></tr></ItemTemplate>
<FooterTemplate><tr><td>This is the footer</td></tr></FooterTemplate>
</asp:Repeater>
Any help would be most appreciated