?
Solved

Error connecting Xmlsource to RSS

Posted on 2011-10-14
11
Medium Priority
?
290 Views
Last Modified: 2012-05-12
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

0
Comment
Question by:deanlee17
  • 6
  • 5
11 Comments
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 36968058
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
 

Author Comment

by:deanlee17
ID: 36968437
Ok that removed the error. But no RSS feeds display on the page :(
0
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 36968469
You need to specify the xpath expression on the xmldatasource as well

http://www.codeproject.com/KB/XML/RSSFeedEx.aspx
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

Author Comment

by:deanlee17
ID: 36968486
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
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 36968505
Try to follow the tutorial
0
 

Author Comment

by:deanlee17
ID: 36968529
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
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 36968790
Just the bottom code which has xpath expressions.
0
 

Author Comment

by:deanlee17
ID: 36968943
Just started from scratch, same error :(
0
 
LVL 83

Accepted Solution

by:
CodeCruiser earned 2000 total points
ID: 36970266
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
 

Author Comment

by:deanlee17
ID: 36978071
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
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 36981673
I tried the your code.
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Suggested Courses

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question