using System; using System.Collections; using System.Configuration; using System.Data; using System.Linq; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Xml.Linq; public partial class uudised : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { XElement voog = XElement.Load("http://www.epl.ee/rss"); var andmed = from teade in voog.Descendants("item") orderby teade.Element("title").Value select new {pealkiri=teade.Element("title").Value, aeg=teade.Element("pubDate").Value, kirjeldus= (teade.Element("description").Value.Length<20)? (teade.Element("description").Value) : teade.Element("description").Value.Substring(0, 20)+ "...", viide=teade.Element("link").Value, }; ListView1.DataSource = andmed; ListView1.DataBind(); /* Ehitage näite põhjal üles ListView, kus teatest on näha * vaid esimesed 20 tähte, edasi link tegelikule allikale */ } }