RSS Feed With ASP.NET

Submitted by planetsourcecode on
We can easily integrate XML feeds into our website very easily. We don't want to know detail knowledge of XML, but knowledge not harm in any ways.for this wrk we wanr to conntrols 1). XMDataSource Control 2). GridView Control. We have to set the following properties of the XMDataSource Control 1. DataFile- to the file where XML feeds Resides example: http://feeds.feedburner.com/NysecomFinancialNewsReleases 2). set XPath="rss/channel/item" so we have done for XMDataSource Control properties it will look like the below code Next we move to the making settings of GridView control properties 1). Place a GridView Control on the webpage 2). change the "DataSourceID" according to the ID of our XMLDataSource. 3). Set the AutoGenerateColumns="False", as we are placing our own controls in the GridView 4). Create a TemplateField column and place ItemTemplatein it and the following controls like label, Hyperlink and set the properties given, in label(property text)='%# XPath("pubDate") %>' in Hyperlink, set text='%# XPath("title") %>' and NavigateUrl='%# XPath("link") %>' it will look like below
and do for AlternatingItemTemplate also the whole GridView will be like that:



and below is the whole page for this article %@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %> %@ Register Src="WebUserControl.ascx" TagName="test" TagPrefix="dd" %> Untitled Page




About the author: Planet Source Code is a place for all developer providing free source codes, articles, complete projects,complete application in PHP, C/C++, Javascript, Visual Basic, Cobol, Pascal, ASP/VBScript, AJAX, SQL, Perl, Python, Ruby, Mobile Development