I am trying to read data from an xml file (API) using the repeater control in vb.net. but I am getting the following error: XmlNodeList' is a type and cannot be used as an expression. The error is pointing at this line from the code below: XmlNodeList nodes = doc.SelectNodes("products/product") Can anyone please help fix this error? The code is shown below: <Script runat="server"> sub Page_Load if Not Page.IsPostBack then Dim doc as XmlDocument = new XmlDocument() doc.Load("this is the url link") XmlNodeList nodes = doc.SelectNodes("products/product") rpMyRepeater.DataSource = nodes rpMyRepeater.DataBind() end if end sub </script> <html> <body> <asp:repeater id="rpMyRepeater" runat="server"> <HeaderTemplate>> </HeaderTemplate> <ItemTemplate> <%# ((System.Xml.XmlNode)Container.DataItem).Attributes["description"].Value %> <%# ((System.Xml.XmlNode)Container.DataItem).InnerXml %> </ItemTemplate> <FooterTemplate> </FooterTemplate> </asp:repeater>
doc.Load("this is the url link")
if
If
Dim nodes As XmlNodeList = doc.SelectNodes("products/product")
<![CDATA[<%# DirectCast(Container.DataItem, System.Xml.XmlNode).Attributes("description").Value %>]]>
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)