using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Xml.Linq;

namespace BookDemo.RSS
{
    public partial class ArticleDetail : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            int id = Convert.ToInt32(Request.QueryString["id"]);
            //读取数据 PS：可以为任意类型的数据源
            XDocument datasource = XDocument.Load("Datasource.xml");
            XElement articleElement = datasource.Root.Elements().Where(z => z.Element("ID").Value == id.ToString()).FirstOrDefault();
            if (articleElement!=null)
            {
                lblTitle.Text = articleElement.Element("Title").Value;
                lblCreateTime.Text = articleElement.Element("CreateTime").Value;
                lblDescription.Text = articleElement.Element("Description").Value;
                lblText.Text = articleElement.Element("Text").Value;
            }
        }
    }
}
