Displaying Rss Feed in Listview also using DataPager in Asp.net sample.
<%
@ Page Language="C#" AutoEventWireup="true" CodeFile="feedtolistview.aspx.cs" Inherits="feedtolistview" %> <!
DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><
html xmlns="http://www.w3.org/1999/xhtml"><
head id="Head1" runat="server"> <title>Using DataPager and ListView Controls with a Custom Data Source</title></
head><
body> <form id="form1" runat="server"> <div> <asp:DataPager ID="dataPager" runat="server" PagedControlID="listItems" QueryStringField="page" PageSize="5" > <Fields> <asp:NextPreviousPagerField FirstPageText="<<" ShowFirstPageButton="True" ShowNextPageButton="False" ShowPreviousPageButton="False" /> <asp:NumericPagerField /> <asp:NextPreviousPagerField LastPageText=">>" ShowLastPageButton="True" ShowNextPageButton="False" ShowPreviousPageButton="False" /> </Fields> </asp:DataPager> <br /> <asp:ListView ID="listItems" runat="server" DataSourceID="xmlDataSource"> <LayoutTemplate> <asp:PlaceHolder runat="server" ID="itemPlaceholder" /> </LayoutTemplate> <ItemTemplate> <h3><a href="<%# XPath("link") %>"><%# XPath("title") %></h3> </a><%
# XPath("description")%> </ItemTemplate> <ItemSeparatorTemplate> <hr /> </ItemSeparatorTemplate> </asp:ListView> <asp:XmlDataSource ID="xmlDataSource" runat="server" DataFile="http://rss.news.yahoo.com/rss/topstories" XPath="rss/channel/item"></asp:XmlDataSource> <asp:DataPager ID="dataPager1" runat="server" PagedControlID="listItems" QueryStringField="page" PageSize="5"> <Fields> <asp:NumericPagerField /> </Fields> </asp:DataPager> </div> </form></
body></
html>
No comments:
Post a Comment