aspx Tutorial

NET Articles,jQuery demo, asp.net with jQuery, online tutorial,Jquery, SilverLight, Javascript, asp.net,JSON, MVC,.NET Articles,demo, Web Services,
Advertise Here

Toolbar

Get our toolbar!

Advertize



Posted by Aamir Hasan   on Tuesday, July 12, 2011 Total Views:  

In this example, I will tell you how to bind RSS feeds to a Repeater using XMLDataSource in asp.net. XMLDataSource reads XML document to display XML data. When you bind XMLDataSource control with Repeater, let's start.

I have created a new ASP.NET application using Visual Studio 2010.Add new page with name Repeater-RSS.aspx.

Drag and drop Repeater and XMLDataSource controls from Toolbox as shown in figure.

Here's an example

<html xmlns="http://www.w3.org/1999/xhtml">

<head runat="server">

    <title>How to bind RSS feeds to a Repeater using XmlDataSource in asp.net </title>

    <style>

        body

        {

            font-size: .70em;

            font-family: "Helvetica Neue" , Verdana, sans-serif;

            margin: 10px;

            padding: 0px;

            color: #696969;

            background-color:#cccccc;

            padding:20px;

          

        }

       

        a:link, a:visited

        {

            color: #034af3;

        }

       

        a:hover

        {

            color: #1d60ff;

            text-decoration: none;

        }

       

        a:active

        {

            color: #034af3;

        }

       

        p

        {

            margin-bottom: 10px;

            line-height: 1.6em;

        }

        table{ margin:0 auto; background-color:#fff; border:1px solid #555;};

       

        h1, h2, h3, h4, h5, h6

        {

            font-size: 1.5em;

            color: #666666;

            font-variant: small-caps;

            text-transform: none;

            font-weight: 200;

            margin-bottom: 0px;

        }

    </style>

</head>

<body>

    <form id="form1" runat="server">

    <div>

        <p>

            <h1>

                How to bind RSS feeds to a Repeater using XmlDataSource in asp.net</h1>

        </p>

        <asp:Repeater ID="Repeater1" runat="server" DataSourceID="XmlDataSource1">

            <ItemTemplate>

                <table border="0" width="90%">

                    <tr>

                        <td>

                            <b>

                                <h3>

                                    <a href=" <%#XPath("link") %>" title="<%#XPath("title") %>">

                                        <%#XPath("title") %></a>

                                </h3>

                            </b>

                            <%#XPath("description") %>

                        </td>

                    </tr>

            </ItemTemplate>

            <FooterTemplate>

                </table>

            </FooterTemplate>

        </asp:Repeater>

        <asp:XmlDataSource ID="XmlDataSource1" runat="server" XPath="/rss/channel/item/."

            DataFile="http://www.aspxtutorial.com/syndication.axd"></asp:XmlDataSource>

    </div>

    </form>

</body>

</html>

Output

Download

Repeater-RSS-rar.rar (1.30 kb)

See Live Demo

Category: All | asp.net | ASP.NET 4.O
Protected by Copyscape Online Plagiarism Tool

Comments (1) -

Carrol Bowlet
Carrol Bowlet United States
7/13/2015 7:42:42 AM #

I would like to thank you for the efforts you have put in writing this blog. I really hope to see the same high-grade blog posts from you later on as well. In fact, your creative writing abilities has inspired me to get my own, personal blog now ;)|

Add comment

  Country flag

biuquote
  • Comment
  • Preview
Loading

Advertizement 1
Advertizement 2
Advertizement 3
Advertizement 4
Advertizement 5