Use this link to
download all of the source for the sample (this .zip file also includes an
atlas install – so you should just be able to download it with a vanilla Visual
Web Developer or VS 2005 install and hit run to launch it). Note that I wrote
this on a plane with a screaming kid behind me – so please be a little
forgiving of the imperfections you find (and I am sure there are some).
Here is what it looks like in either the free Visual Web
Developer IDE or in VS 2005:
Note that it contains three .aspx pages – MyList.aspx,
Items.aspx, and RSS.aspx. MyList.aspx and Items.aspx are both based on a
common master-page (Site.Master) that provides common layout information.
All style information is stored in the .css file.
The data for the application is stored within the Tasks.mdf
file (which is a SQL Express file). I then also created a set of strongly-typed
dataset table adapters for the two tables I used within the database (these
table adapters are declaratively defined within the Lists.xsd file).
As you can see above, both MyList.aspx and Items.aspx are
fully supported in the WYSIWYG designer mode. Here is the full
code-listing for what the MyList.aspx code-behind file looks like (note: this
code-behind is the largest of the three files):
Note that the first method is the event handler action for
the “add” button gets clicked. It creates a new List in the
database. The next three methods are formatting methods I use during
data-binding to perform some fancier data-transforms (for example: I store the
priority of lists as an integer in the database as opposed to a string for better
sorting semantics, but want a nice drop-down list and text value displayed in
the browser, etc). If I wanted a quick and dirty bare-bones list editing
system, I could have just skipped doing these. I’m then using a
declarative ObjectDataSource binding (a new ASP.NET 2.0 feature) to-do update
and delete data semantics with the List adapter as well.