Go Back   Velocity Reviews > Newsgroups > ASP Net
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply

ASP Net - Rss feed

 
Thread Tools Search this Thread
Old 04-22-2008, 07:52 AM   #1
Default Rss feed


I am showing a rss feed in a listview in asp.net 3.5.Currenly I am
showing everyitem,but I would like to show top 5 articles.I am giving
my code below.




XDocument feedXML = XDocument.Load("http://
feeds.encosia.com/Encosia");
var feeds = from feed in feedXML.Descendants("item")
select new
{
Title = feed.Element("title").Value,
Link = feed.Element("link").Value,
Description =
feed.Element("description").Value
};

PostList.DataSource = feeds;
PostList.DataBind();
Here PostList is the id of the listview .Can anybody sujjest How I
would able show the top 5 articles.?


Arnab das
  Reply With Quote
Old 04-22-2008, 12:59 PM   #2
Madhur
 
Posts: n/a
Default Re: Rss feed
If you are using .NET 3.5, you can use System.ServiceModel.Syndication
namespace to handle RSS.

You need not handle it yourself with XML.

--
Madhur

"Arnab das" <> wrote in message
news:b8d836d6-e1e0-4ca3-a862-...
>I am showing a rss feed in a listview in asp.net 3.5.Currenly I am
> showing everyitem,but I would like to show top 5 articles.I am giving
> my code below.
>
>
>
>
> XDocument feedXML = XDocument.Load("http://
> feeds.encosia.com/Encosia");
> var feeds = from feed in feedXML.Descendants("item")
> select new
> {
> Title = feed.Element("title").Value,
> Link = feed.Element("link").Value,
> Description =
> feed.Element("description").Value
> };
>
> PostList.DataSource = feeds;
> PostList.DataBind();
> Here PostList is the id of the listview .Can anybody sujjest How I
> would able show the top 5 articles.?




Madhur
  Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46