Error connecting Xmlsource to RSS

Hi Experts, am new to this, getting the following error with the attached code....

The DataSourceID of 'DataList1' must be the ID of a control of type IDataSource.  A control with ID 'XmlDataSource1' could not be found.


Thanks,
Dean
<body>
    <form runat="server">
    <div class="page">
       

               <asp:ContentPlaceHolder ID="MainContent" runat="server">
                <asp:XmlDataSource ID="XmlDataSource1" runat="server" 
                    DataFile="http://spaces.msn.com/members/mauliksoni/feed.rss"></asp:XmlDataSource>
            </asp:ContentPlaceHolder>

     
            <asp:DataList ID="DataList1" runat="server" DataSourceID="XmlDataSource1">

               <ItemTemplate>
               <%#XPath("title") %>
               <hr />
               <%# XPath("description")%><br />
             </ItemTemplate>
         
            </asp:DataList>


    <div class="footer">
        
    </div>
    </form>
</body>

Open in new window

deanlee17Asked:
Who is Participating?
 
CodeCruiserCommented:
I just tried the code myself and the problem seems to be with the feed. The feed that you have redirects to a blog. I tried with BBC feed and it works

http://feeds.bbci.co.uk/news/world/rss.xml
0
 
CodeCruiserCommented:
Try following code



<body>
    <form runat="server">
    <div class="page">
       

               <asp:ContentPlaceHolder ID="MainContent" runat="server">
                <asp:XmlDataSource ID="XmlDataSource1" runat="server" 
                    DataFile="http://spaces.msn.com/members/mauliksoni/feed.rss"></asp:XmlDataSource>

     
            <asp:DataList ID="DataList1" runat="server" DataSourceID="XmlDataSource1">

               <ItemTemplate>
               <%#XPath("title") %>
               <hr />
               <%# XPath("description")%><br />
             </ItemTemplate>
         
            </asp:DataList>


    <div class="footer">
                    </asp:ContentPlaceHolder>
    </div>
    </form>
</body>

Open in new window

0
 
deanlee17Author Commented:
Ok that removed the error. But no RSS feeds display on the page :(
0
Cloud Class® Course: Amazon Web Services - Basic

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

 
CodeCruiserCommented:
You need to specify the xpath expression on the xmldatasource as well

http://www.codeproject.com/KB/XML/RSSFeedEx.aspx
0
 
deanlee17Author Commented:
Ah yes I removed it when trying to get it to work. Ive added it back in and same problem.
<body>
    <form id="Form1" runat="server">
    <div class="page">
       

               <asp:ContentPlaceHolder ID="MainContent" runat="server">
                <asp:XmlDataSource ID="XmlDataSource1" runat="server" 
                    DataFile="http://spaces.msn.com/members/mauliksoni/feed.rss" 
                       XPath="rss/channel/item"></asp:XmlDataSource>

     
            <asp:DataList ID="DataList1" runat="server" DataSourceID="XmlDataSource1">

            </asp:DataList>


    <div class="footer">
                    </asp:ContentPlaceHolder>
    </div>
    </form>
</body>

Open in new window

0
 
CodeCruiserCommented:
Try to follow the tutorial
0
 
deanlee17Author Commented:
I did lol, thats how I got to this stage, was a little bit confused by part 8 as to whether I needed to add both sections of code
0
 
CodeCruiserCommented:
Just the bottom code which has xpath expressions.
0
 
deanlee17Author Commented:
Just started from scratch, same error :(
0
 
deanlee17Author Commented:
Hi Code,

Did you try with my code or did you run through the tutorial urself? I changed the link but still no feed.

Thanks,
Dean
0
 
CodeCruiserCommented:
I tried the your code.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.