Datasheet

Listing 1-13 (continued)
<year>2005</year>
<month>02</month>
<title>Title2</title>
<content>This is the text of Title2.</content>
</article>
<article>
<year>2005</year>
<month>02</month>
<title>Title3</title>
<content>This is the text of Title3.</content>
</article>
<article>
<year>2006</year>
<month>01</month>
<title>Title4</title>
<content>This is the text of Title4.</content>
</article>
<article>
<year>2006</year>
<month>01</month>
<title>Title5</title>
<content>This is the text of Title5.</content>
</article>
<article>
<year>2006</year>
<month>02</month>
<title>Title6</title>
<content>This is the text of Title6.</content>
</article>
</articles>
The code in Listing 1-12 uses an XML file (see Listing 1-13) as the datasource for a very simple imple-
mentation. The ArticlesData class uses the data to populate Article objects, as shown in Listing 1-14.
Listing 1-14: The Article class is a business object that will be bound to a GridView in
the UI layer: Article.cs
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
/// <summary>
/// Represents an Article
/// </summary>
public class Article
{
22
Chapter 1
04_597663 ch01.qxp 4/25/06 9:54 PM Page 22