ListView - Binding to RSS feed

honda world news
rss monday, february 27, 2017

 
Mon, 27 Feb 2017 14:00:00 +0900
  One Million Automobile Production Milestone in Indonesia http://world.honda.com/shared/img/flag/indonesia_flag.gif Karawang, Indonesia - PT Honda Prospect Motor celebrated its one million-unit automobile production milestone in Indonesia at a ceremony held at the Karawang Factory.
 
Mon, 27 Feb 2017 14:00:00 +0900
  Honda Sets Monthly Records http://world.honda.com/shared/img/flag/japan_flag.gif Honda announced a summary of its automobile production, Japan domestic sales, and export results for the month of January 2017.
 
Sun, 26 Feb 2017 21:00:00 +0900
  First Points for Hayden and Bradl http://world.honda.com/shared/img/flag/australia_flag.gif PHILLI ISLAND, Australia - The Red Bull Honda World Superbike Team has contested the opening race of the 2017 FIM Superbike World Championship at Phillip Island, with Nicky Hayden and Stefan Bradl finishing eleventh and fifteenth respectively.
Isolate this demo as a stand-alone application
  • About this demo
  • C#
  • VB

This demo shows how to bind RadListView to XML RSS feed server-side.

  • DefaultCS.aspx
  • DefaultCS.aspx.cs
  • scripts.js
  • styles.css
<%@ Page Language="c#" Inherits="Telerik.ListViewExamplesCSharp.DataBinding.RSSFeed.DefaultCS"CodeFile="DefaultCS.aspx.cs"  %>

<%@ Import Namespace="System.Xml" %>
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns='http://www.w3.org/1999/xhtml'>
<head runat="server">
    <title>Telerik ASP.NET Example</title>
    <link href="styles.css" rel="stylesheet" type="text/css" />
</head>
<body>
    <form id="form1" runat="server">
    <telerik:RadScriptManager runat="server" ID="RadScriptManager1" />
    <telerik:RadSkinManager ID="RadSkinManager1" runat="server" ShowChooser="true" />
    <script type="text/javascript" src="scripts.js">
    </script>
    <div class="demo-container size-wide">
        <telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server" LoadingPanelID="RadAjaxLoadingPanel1">
            <telerik:RadListView ID="RadListView1" runat="server" RenderMode="Lightweight" OnNeedDataSource="RadListView1_NeedDataSource"
                AllowPaging="true" ItemPlaceholderID="Panel1" PageSize="3">
                <LayoutTemplate>
                    <div class="layoutWrapper">
                        <div class="rssHeaderWrapper" title="Copyright, 2011 Honda Motor Co., Ltd. and its subsidiaries and affiliates. All Rights Reserved.">
                            <div class="rssSubHeader">
                                honda world news
                            </div>
                            <div class="rssHeader">
                                rss <span class="rssHeadingDate">
                                    <%# DateTime.Now.ToLongDateString().ToLower() %></span>
                            </div>
                        </div>
                        <br />
                        <table class="rssTable">
                            <asp:Panel ID="Panel1" runat="server"></asp:Panel>
                        </table>

                        <div class="imageWrapper">
                            <asp:ImageButton ID="PrevBtn" runat="server" CommandName="Page" CommandArgument="Prev"
                                AlternateText="<" CssClass="rssButtons" ImageUrl="images/iconPrev.png"></asp:ImageButton>
                            <asp:ImageButton ID="RefreshBtn" runat="server" CommandName="Rebind" AlternateText="Refresh"
                                CssClass="rssButtons" ImageUrl="images/iconRefresh.png"></asp:ImageButton>
                            <asp:ImageButton ID="NextBtn" runat="server" CommandName="Page" CommandArgument="Next"
                                AlternateText=">" CssClass="rssButtons" ImageUrl="images/iconNext.png"></asp:ImageButton>
                        </div>
                    </div>
                </LayoutTemplate>
                <ItemTemplate>
                    <tr>
                        <td>&nbsp;
                        </td>
                        <td colspan="2">
                            <div class="rssTitle">
                                <img src="images/iconRSS.png" alt="rss" />
                                <a href='<%# GetXmlContent(Container, "link") %>' class="qsfSubtitle">
                                    <%# GetXmlContent(Container, "title") %>
                                </a>
                            </div>
                            <div class="rssDate">
                                <%# GetXmlContent(Container, "pubDate")%>
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td>&nbsp;
                        </td>
                        <td>
                            <img src='<%# GetXmlContent(Container, "hww:photo") %>' class="qsfPhoto"
                                alt='<%# GetXmlContent(Container, "title") %>' />
                        </td>
                        <td>
                            <img src='<%# GetXmlContent(Container, "hww:flag") %>' alt='<%# GetXmlContent(Container, "hww:flag") %>' />
                            <span class="rssDescription">
                                <%# GetXmlContent(Container, "description")%></span>
                        </td>
                    </tr>
                </ItemTemplate>
            </telerik:RadListView>
        </telerik:RadAjaxPanel>
        <asp:Label ID="lblMessage" Visible="false" CssClass="message" runat="server" />
        <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Skin="Black" OnClientShowing="loadingPanelShowing">
        </telerik:RadAjaxLoadingPanel>
    </div>
    </form>
</body>
</html>

Find Assistance

Help Us Improve

Was this example helpful?