ListView - Binding to RSS feed

honda world news
rss thursday, march 23, 2017

 
Wed, 22 Mar 2017 11:29:00 +0900
  Marquez Commences New Title Fight in the Desert http://world.honda.com/shared/img/flag/qatar_flag.gif LOSAIL, Qatar - The 69th season of motorcycle Grand Prix roars into action in Qatar, where Honda will commence its defense of the riders and constructors MotoGP World Championships.
 
Tue, 21 Mar 2017 09:42:00 +0900
  Seely Fifth at Indianapolis Supercross http://world.honda.com/shared/img/flag/usa_flag.gif Round 11 of the AMA Supercross series at Indianapolis' Lucas Oil Stadium saw Team Honda HRC's Cole Seely produce another fifth-place finish aboard his CRF450R.
 
Mon, 20 Mar 2017 16:21 +0900
  Podium Double and Championship Lead for Team HRC http://world.honda.com/shared/img/flag/argentina_flag.gif Neuquén, Argentina - Securing the first double podium of the year for Honda, Tim Gajser and Evgeny Bobryshev muscled their CRF450RWs to a spectacular first and third overall in the beautiful Patagonian landscape, for the third round of the MXGP.
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?