<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://devlicio.us/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Christopher Bennage : ASP.NET</title><link>http://devlicio.us/blogs/christopher_bennage/archive/tags/ASP.NET/default.aspx</link><description>Tags: ASP.NET</description><dc:language>en</dc:language><generator>CommunityServer 2008.5 SP1 (Build: 31106.3070)</generator><item><title>thinking out loud: asp.net mvc &amp; nhaml</title><link>http://devlicio.us/blogs/christopher_bennage/archive/2009/10/02/thinking-out-loud-asp-net-mvc-amp-nhaml.aspx</link><pubDate>Fri, 02 Oct 2009 20:48:00 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:51989</guid><dc:creator>Christopher Bennage</dc:creator><slash:comments>9</slash:comments><description>&lt;p&gt;I’ve been playing around with the view engine &lt;a title=".NET implementation of the popular Rails Haml view engine" href="http://code.google.com/p/nhaml/" target="_blank"&gt;nhaml&lt;/a&gt; and asp.net mvc. At the same time, I’m playing around with some architectural ideas in hope to benefit future projects.&lt;/p&gt;  &lt;p&gt;I’m not doing any fancy yet, but I thought that it might be interesting to show you a couple of things to see what you think. Bear in mind, this is my sandbox code. I also suspect that I’m reinventing some wheels.&lt;/p&gt;  &lt;p&gt;The context here is a page that allows a user to register for an account on the site.&lt;/p&gt;  &lt;p&gt;First, the view looks like this:&lt;/p&gt;  &lt;pre&gt;%h2 Create Account

%form{method=&amp;quot;post&amp;quot;}
  = Html.FormField&amp;lt;OpenAccount&amp;gt;(x=&amp;gt;x.AccountName)
  = Html.FormField&amp;lt;OpenAccount&amp;gt;(x=&amp;gt;x.EmailAddress)
  = Html.FormField&amp;lt;OpenAccount&amp;gt;(x=&amp;gt;x.Password)
  
  %input {type=&amp;quot;submit&amp;quot; value=&amp;quot;Save&amp;quot;}
  %button {onclick=&amp;quot;javascript:history.back()&amp;quot; type=&amp;quot;button&amp;quot;} Cancel&lt;/pre&gt;

&lt;p&gt;OpenAccount is my view model. (I hate how we’ve overloaded these&amp;#160; terms.)&lt;/p&gt;

&lt;p&gt;I really like the succinctness of the nhaml, though I’m not ready to commit to it 100%. &lt;a href="http://dev.dejardin.org/" target="_blank"&gt;Spark&lt;/a&gt; is very attractive to me as well.&lt;/p&gt;

&lt;p&gt;Html.FormField is an extension method I wrote. I’m toying with the idea of having it emit a &amp;lt;lablel /&amp;gt; paired with the &amp;lt;input /&amp;gt;. Part of my motivation here is standardizing all of the label/inputs in my forms as well as a few experimental ideas about localization. &lt;/p&gt;

&lt;p&gt;It’s rather naive at the moment, but here is the helper:&lt;/p&gt;

&lt;pre class="c#:nogutter:nocontrols" name="code"&gt;public static string FormField&amp;lt;T&amp;gt;(this HtmlHelper helper, Expression&amp;lt;Func&amp;lt;T, string&amp;gt;&amp;gt; property)
    where T : class, ICommand
{
    var model = helper.ViewData.Model as T;
    if (helper.ViewData.Model != null &amp;amp;&amp;amp; model == null) throw new InvalidOperationException();

    var expression = (MemberExpression)property.Body;
    var name = expression.Member.Name;

    var value = (model == null)
                    ? null
                    : property.Compile().Invoke(model);

    return helper.TextBox(name, value);
}&lt;/pre&gt;

&lt;p&gt;Yeah, I hardcoded to a textbox for the moment. As I said, this is just a sandbox spike.&lt;/p&gt;

&lt;p&gt;Finally, the associated controller action looks like this:&lt;/p&gt;

&lt;pre class="c#:nogutter:nocontrols" name="code"&gt;[AcceptVerbs(HttpVerbs.Post)]
public ActionResult Create(OpenAccount form)
{
    var result = _backend.Execute(form);

    return result.Success
               ? (ActionResult) RedirectToAction(&amp;quot;WhateverIsNext&amp;quot;)
               : View(result);
}&lt;/pre&gt;

&lt;p&gt;I’m treating the incoming form as a command. The _backend is responsible for processing the command. The command is just information necessary to execute the command, not the logic to execute it. The result I’m getting back is actually an instance of the same command with information attached by the backend (e.g., did the command execute correctly, what were the validation errors). It’s not exactly &lt;a title="single responsibility principle" href="http://en.wikipedia.org/wiki/Single_responsibility_principle" target="_blank"&gt;SRP&lt;/a&gt;, however I’m influenced by the simplicity of RoR here. &lt;/p&gt;

&lt;p&gt;One more interesting bit. I really don’t like having actions in my controller that do nothing other than render the view. For example:&lt;/p&gt;

&lt;pre class="c#:nogutter:nocontrols" name="code"&gt;[AcceptVerbs(HttpVerbs.Get)]
public ActionResult Create()
{
    return View();
}&lt;/pre&gt;

&lt;p&gt;So instead, I created a base controller that does this:&lt;/p&gt;

&lt;pre class="c#:nogutter:nocontrols" name="code"&gt;public class ControllerBase : Controller
{
    protected override void HandleUnknownAction(string actionName)
    {
        try
        {
            View(actionName).ExecuteResult(ControllerContext);
        }
        catch (InvalidOperationException e)
        {
            //show the error or something
        }
    }
}&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://devlicio.us/aggbug.aspx?PostID=51989" width="1" height="1"&gt;</description><category domain="http://devlicio.us/blogs/christopher_bennage/archive/tags/ASP.NET/default.aspx">ASP.NET</category><category domain="http://devlicio.us/blogs/christopher_bennage/archive/tags/MVC/default.aspx">MVC</category><category domain="http://devlicio.us/blogs/christopher_bennage/archive/tags/nhaml/default.aspx">nhaml</category></item><item><title>Bellware: Classic ASP Syntax is Bad?</title><link>http://devlicio.us/blogs/christopher_bennage/archive/2007/09/23/bellware-classic-asp-syntax-is-bad.aspx</link><pubDate>Sun, 23 Sep 2007 19:08:36 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:38466</guid><dc:creator>Christopher Bennage</dc:creator><slash:comments>7</slash:comments><description>&lt;p&gt;I want to link to Scott Bellware&amp;#39;s &lt;a href="http://codebetter.com/blogs/scott.bellware/archive/2007/09/22/168410.aspx" target="_blank"&gt;post&lt;/a&gt; on attitudes regarding classic ASP. He makes an excellent point, and I agree with him.&lt;/p&gt; &lt;p&gt;About four years ago, I remember telling my former employer about the epic superiority of ASP.NET over classic ASP. I could not deride classic ASP enough.&lt;em&gt; Boy, was I a jerk!&lt;/em&gt;&lt;/p&gt; &lt;p&gt;Now, I don&amp;#39;t want to return to classic ASP, but I have learned to appreciate it again.&amp;nbsp; Just as Scott points out, you can have good code in classic ASP and bad code in ASP.NET (quite easily).&lt;/p&gt; &lt;p&gt;Not too long ago I had to create a classic ASP page for some reason or the other, and I recall thinking being surprised at how simple it was (translate that as &amp;quot;easy&amp;quot;).&amp;nbsp; This reminds a bit of the &lt;a href="http://blogs.msdn.com/nickkramer/archive/2006/11/21/javascript-the-underappreciated-language.aspx" target="_blank"&gt;rediscovery of JavaScript&lt;/a&gt; last year.&lt;/p&gt; &lt;p&gt;So, what&amp;#39;s the point of saying this?&amp;nbsp; I&amp;#39;m not going to starting working with classic ASP again, but the lesson for me is to be more thoughtful in forming my opinions about a technologies. We developers are quite punctilious and we consider our views are as sacrosanct. (I was vividly reminded of this at our Tallahassee Code Camp, as well as being dealt a crushing lesson in humility, but more on that later...)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://devlicio.us/aggbug.aspx?PostID=38466" width="1" height="1"&gt;</description><category domain="http://devlicio.us/blogs/christopher_bennage/archive/tags/ASP.NET/default.aspx">ASP.NET</category><category domain="http://devlicio.us/blogs/christopher_bennage/archive/tags/javascript/default.aspx">javascript</category><category domain="http://devlicio.us/blogs/christopher_bennage/archive/tags/Musings/default.aspx">Musings</category></item><item><title>Your Development Tools</title><link>http://devlicio.us/blogs/christopher_bennage/archive/2006/10/18/Your-Development-Tools.aspx</link><pubDate>Wed, 18 Oct 2006 18:14:00 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:355</guid><dc:creator>Christopher Bennage</dc:creator><slash:comments>17</slash:comments><description>&lt;p&gt;Every now and then I like to get a pulse on what people are using
for their development environment.&amp;nbsp; I&amp;#39;m continually picking
after useful tools from reading other developer&amp;#39;s posts.&amp;nbsp; I&amp;#39;d
like to know what your primary tools are, your list of favorites that
you might not use every day, and what type of development work you
tend to do.&lt;/p&gt;

&lt;p&gt;For the most part, I&amp;#39;m a Web developer.&amp;nbsp; Though, I&amp;#39;m spending
a lot of time with WPF (expect some posts shortly) and I&amp;#39;d like to
take my business in that direction.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Daily Tools&lt;/strong&gt;&lt;span&gt;:&amp;nbsp;&lt;/span&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p style="margin-bottom:0in;"&gt;Visual Studio 2005&lt;/p&gt;
	&lt;/li&gt;
&lt;li&gt;
&lt;p style="margin-bottom:0in;"&gt;SQL Server Management Studio&lt;/p&gt;
	&lt;/li&gt;
&lt;li&gt;
&lt;p style="margin-bottom:0in;"&gt;&lt;a href="http://www.jetbrains.com/resharper/index.html" target="_blank"&gt;ReSharper&lt;/a&gt;,
	If you don&amp;#39;t know about ReSharper, go download it now.&lt;/p&gt;
	&lt;/li&gt;
&lt;li&gt;
&lt;p style="margin-bottom:0in;"&gt;&lt;a href="http://www.roland-weigelt.de/ghostdoc/"&gt;GhostDoc&lt;/a&gt;,
	perfect for the lazy developer who needs to generate documentation&lt;/p&gt;
	&lt;/li&gt;
&lt;li&gt;
&lt;p style="margin-bottom:0in;"&gt;&lt;a href="http://subversion.tigris.org/"&gt;Subversion&lt;/a&gt;,
	I will never use VSS again&lt;/p&gt;
	&lt;/li&gt;
&lt;li&gt;
&lt;p style="margin-bottom:0in;"&gt;&lt;a href="http://tortoisesvn.tigris.org/"&gt;TortoiseSVN&lt;/a&gt;,
	my preferred client for Subversion (at the moment)&lt;/p&gt;
	&lt;/li&gt;
&lt;li&gt;
&lt;p style="margin-bottom:0in;"&gt;&lt;a href="http://www.editplus.com/"&gt;EditPlus&lt;/a&gt;,
	because sometimes I just don&amp;#39;t want to launch VS&lt;/p&gt;
	&lt;/li&gt;
&lt;li&gt;
&lt;p style="margin-bottom:0in;"&gt;&lt;a href="http://www.newsgator.com/NGOLProduct.aspx?ProdID=TopStyle"&gt;TopStyle&lt;/a&gt;,
	excellent CSS editor&lt;/p&gt;
	&lt;/li&gt;
&lt;li&gt;
&lt;p style="margin-bottom:0in;"&gt;&lt;a href="http://www.basecamphq.com/"&gt;BaseCamp&lt;/a&gt;,
	this is a very recent edition&lt;/p&gt;
	&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href="http://www.nunit.org/"&gt;NUnit&lt;/a&gt;, and ReSharper
	provides an interface for running your tests in VS!&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Not Quite Daily&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p style="margin-bottom:0in;"&gt;&lt;a href="http://www.aisto.com/roeder/dotnet/"&gt;Lutz
	Roeder&amp;#39;s Reflector&lt;/a&gt;, you can learn a lot for dissecting the .NET
	framework&lt;/p&gt;
	&lt;/li&gt;
&lt;li&gt;
&lt;p style="margin-bottom:0in;"&gt;&lt;a href="http://sourceforge.net/projects/regulator"&gt;Roy
	Osherove&amp;#39;s Regulator&lt;/a&gt;, invaluable for experimenting with Regular
	Expressions&lt;/p&gt;
	&lt;/li&gt;
&lt;li&gt;
&lt;p style="margin-bottom:0in;"&gt;&lt;a href="http://www.red-gate.com/products/SQL_Prompt/index.htm"&gt;SQL
	Prompt&lt;/a&gt;, This adds database-specific Intellisense in your SQL
	editor!&lt;/p&gt;
	&lt;/li&gt;
&lt;li&gt;
&lt;p style="margin-bottom:0in;"&gt;Dreamweaver, Hmmm, why do I feel
	like I need to defend this?&lt;/p&gt;
	&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Fireworks, I was really into Macromedia several years back.
	This is what I use for creating art assets when I need them.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;span style="font-weight:bold;"&gt;Things I Used to Use&lt;/span&gt;:&amp;nbsp;&lt;/p&gt;&lt;p&gt;Base on my list from April of 2004.&lt;br /&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p style="margin-bottom:0in;"&gt;CodeSmith, not that it is bad, I
	just don&amp;#39;t do much code generation lately&lt;/p&gt;
	&lt;/li&gt;
&lt;li&gt;
&lt;p style="margin-bottom:0in;"&gt;SourceGear Vault, I ended up
	migrating to Subversion&lt;/p&gt;
	&lt;/li&gt;
&lt;li&gt;
&lt;p style="margin-bottom:0in;"&gt;Altova XMLSpy, well, er, I&amp;#39;m just
	using EditPlus (or VS&amp;#39;s built in XML editor)&lt;/p&gt;
	&lt;/li&gt;
&lt;li&gt;
&lt;p style="margin-bottom:0in;"&gt;NAnt, after VS2005 I&amp;#39;m using
	msbuild.&amp;nbsp; Honestly, it&amp;#39;s kind of hard to tell the difference&lt;/p&gt;
	&lt;/li&gt;
&lt;li&gt;
&lt;p style="margin-bottom:0in;"&gt;NDoc, :-(&amp;nbsp; I&amp;#39;m keeping an eye
	on &lt;a href="https://blogs.msdn.com/sandcastle/"&gt;Sandcastle&lt;/a&gt;&lt;/p&gt;
	&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href="http://www.targetprocess.com/"&gt;TargetProcess&lt;/a&gt;,
	still a cool tool&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&amp;nbsp;&lt;strong&gt;Tools I&amp;#39;m Keeping An Eye On&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p style="margin-bottom:0in;"&gt;&lt;a href="http://www.visualsvn.com/"&gt;VisualSVN&lt;/a&gt;,
	as I mentioned in my &lt;a href="http://devlicious.com/blogs/christopher_bennage/archive/2006/10/04/Subversion-for-Source-Control.aspx"&gt;post
	on Subversion&lt;/a&gt;&lt;/p&gt;
	&lt;/li&gt;
&lt;li&gt;
&lt;p style="margin-bottom:0in;"&gt;&lt;a href="http://blogs.msdn.com/xmlteam/archive/2006/09/05/741251.aspx"&gt;XML
	Notepad 2006&lt;/a&gt;&lt;/p&gt;
	&lt;/li&gt;
&lt;li&gt;
&lt;p style="margin-bottom:0in;"&gt;&lt;a href="https://blogs.msdn.com/sandcastle/"&gt;Sandcastle&lt;/a&gt;,
	Microsoft&amp;#39;s auto-generated documentation solution 
	&lt;/p&gt;
	&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href="http://www.microsoft.com/products/expression/en/web_designer/default.mspx"&gt;Expression
	Web Designer&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.aptana.com/"&gt;Aptana&lt;/a&gt;, the JavaScript editor looks good.&lt;br /&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&amp;nbsp;&lt;span style="font-weight:bold;"&gt;Things I Hope To Use Daily&lt;/span&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p style="margin-bottom:0in;"&gt;Castle Project 
	&lt;/p&gt;
	
&lt;ul&gt;
&lt;li&gt;
&lt;p style="margin-bottom:0in;"&gt;&lt;a href="http://castleproject.org/index.php/MonoRail"&gt;MonoRail&lt;/a&gt;
		- Rails framework for .NET, it&amp;#39;s a replacement for ASP.NET. I hope
		to make this a regular addition during the next few months.&lt;/p&gt;
		&lt;/li&gt;
&lt;li&gt;
&lt;p style="margin-bottom:0in;"&gt;&lt;a href="http://castleproject.org/index.php/Container"&gt;Windsor&lt;/a&gt;
		- an increasingly popular &lt;a href="http://www.martinfowler.com/bliki/InversionOfControl.html"&gt;Inversion
		of Control&lt;/a&gt; solution. 
		&lt;/p&gt;
	&lt;/li&gt;
&lt;/ul&gt;
	&lt;/li&gt;
&lt;li&gt;
&lt;p style="margin-bottom:0in;"&gt;&lt;a href="http://www.netfx3.com/"&gt;Windows
	Presentation Foundation&lt;/a&gt; - &lt;em&gt;Amazing&lt;/em&gt;.&amp;nbsp; See &lt;a href="http://devlicious.com/blogs/rob_eisenberg/default.aspx"&gt;Rob
	Eisenberg&lt;/a&gt;&amp;#39;s series of posts on .NET 3.0 
	&lt;/p&gt;
	&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href="http://www.microsoft.com/products/expression/en/interactive_designer/default.mspx"&gt;Expression
	Interactive Designer&lt;/a&gt;,UI designer for WPF/.NET 3.0&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://atlas.asp.net"&gt;ASP.NET AJAX&lt;/a&gt; or &lt;a href="http://dojotoolkit.org/"&gt;Dojo&lt;/a&gt;, both are cool and increasingly feature rich JavaScript libraries.&lt;br /&gt;&lt;/li&gt;
&lt;/ul&gt;&amp;nbsp;James Avery wrote about &lt;a href="http://msdn.microsoft.com/msdnmag/issues/05/12/VisualStudioAddins/"&gt;ten
essential VS add-ins&lt;/a&gt; in MSDN Magazine.&amp;nbsp; Let&amp;#39;s have your lists!
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://devlicio.us/aggbug.aspx?PostID=355" width="1" height="1"&gt;</description><category domain="http://devlicio.us/blogs/christopher_bennage/archive/tags/ASP.NET/default.aspx">ASP.NET</category><category domain="http://devlicio.us/blogs/christopher_bennage/archive/tags/development+tools/default.aspx">development tools</category></item><item><title>Subversion for Source Control</title><link>http://devlicio.us/blogs/christopher_bennage/archive/2006/10/04/Subversion-for-Source-Control.aspx</link><pubDate>Thu, 05 Oct 2006 03:43:00 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:203</guid><dc:creator>Christopher Bennage</dc:creator><slash:comments>8</slash:comments><description>
&lt;p style="margin-bottom:0in;"&gt;&lt;strong&gt;&lt;font size="4"&gt;Background&lt;/font&gt;&lt;/strong&gt;:&lt;br /&gt;We&amp;#39;ve
been using Subversion for source control on our extensive ASP.NET
project for the last year. It was the fourth tool we tried, and the one that
stuck. We have an automated build process and a distributed team. Our
repository resides in Minnesota and we have developers in Florida.&lt;br /&gt;We
started about 18 months ago with Visual Source Safe, and poor WAN
performance led us to try &lt;a href="http://www.sourcegear.com/sos/index.html"&gt;Source
OffSite&lt;/a&gt; as well as &lt;a href="http://www.nesterovsky-bros.com/data/download.xml"&gt;SCCBridge&lt;/a&gt;.
SOS worked well, but I wanted to investigate free alternatives.
SCCBridge was free and looked promising, but I could not get it to
work with our server.&lt;br /&gt;We then installed a demo of SourceGear&amp;#39;s
&lt;a href="http://www.sourcegear.com/vault/index.html"&gt;Vault&lt;/a&gt;. I
liked the fact that it had a SQL back end. Performance was better
that SOS (slightly), but we had a problem with sessions timing out.
If you&amp;#39;ve never seen it, check out their &lt;a href="http://vaultthemovie.com/"&gt;movie
trailer&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;I&amp;#39;ve was also evaluating &lt;a href="http://www.targetprocess.com/"&gt;TargetProcess&lt;/a&gt;
at the time and their road map included integration with &lt;a href="http://subversion.tigris.org/"&gt;Subversion&lt;/a&gt;.
(I think it was originally slated for November 2005, it&amp;#39;s now planned
for January 2007).  When the demo for Vault was about to expire, and
after reflecting on the minor problems, I decided to to install
Subversion.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;font size="4"&gt;About Subversion Clients&lt;/font&gt;&lt;/strong&gt;:&lt;br /&gt;The
trick with Subversion is that there are multiple clients available
and you&amp;#39;ll need to find the client that is the best fit. &lt;br /&gt;At first
we choose two: &lt;a href="http://tortoisesvn.tigris.org/"&gt;TortoiseSVN
&lt;/a&gt;and &lt;a href="http://ankhsvn.tigris.org/"&gt;AnkhSVN&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Tortoise
seems to be the overall favorite of the community. It integrates into
Windows Explorer. At first, I found this a bit strange, but I quickly
got used to it. It provides a rich interface as well as diff/merge
tools and frequent updates&lt;br /&gt;&lt;br /&gt;Ankh is a plugin for VS.NET. It
does not use the SCC API, so I avoided it at first. (Not using the
API means that VS.NET doesn&amp;#39;t know that the files are under source
control.) I did try &lt;a href="http://www.pushok.com/soft_svn.php"&gt;SVN
SCC Proxy&lt;/a&gt;, a commercial client that uses the API, but it has
special needs. I have decided that I did no mind VS.NET being
ignorant about the source control, if you&amp;#39;ve ever dealt with the
&lt;em&gt;Change Source Control&lt;/em&gt; dialog box you&amp;#39;ll probably agree.
(Note: I was still using 2003 at this time.)&lt;/p&gt;

&lt;p style="margin-bottom:0in;"&gt;I stopped using AnkhSVN after Visual
Studio 2005 came out because of compatibility problems, however their
sites says that the current release is compatible. Tortoise meets
most of my needs.  The biggest inconvenience is that when adding new
files to your solution\project you have to remember to add them to
source control manually.  (This could be a big hassle depending on how you
work.)&lt;/p&gt;

&lt;p style="margin-bottom:0in;"&gt;Alternatively, there&amp;#39;s a new player on
the field, &lt;a href="http://www.visualsvn.com/"&gt;VisualSVN&lt;/a&gt;,
moderately priced at $19 and integrating with Visual Studio, it looks
very promising.  However, it is still new and is not yet full
featured.  Keep an eye on it though.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;font size="4"&gt;Of
Special Note&lt;/font&gt;&lt;/strong&gt;:&lt;br /&gt;I&amp;#39;m not going to walk through the
entire setup process, but rather point out a few caveats. I do
recommend &lt;em&gt;not&lt;/em&gt; being lazy; read through the manual that comes
with Subversion. (The product is different enough from the
VSS/SourceGear model to be confusing.)&lt;br /&gt;&lt;br /&gt;The most important
thing to note is the standard Subversion client (and hence all the
third party clients) used a hidden directory to store metadata about
files under source control. The directory is labelled .&lt;strong&gt;svn&lt;/strong&gt;.&lt;br /&gt;This
chokes an ASP.NET application. Well, it did with 1.1, I haven&amp;#39;t
tested it with 2.0.&lt;br /&gt;Tortoise provides a special option during
their install to use &lt;strong&gt;_svn&lt;/strong&gt; instead. Likewise, Ankh
provides a configuration that allows you to specify the directory
name. Do not use Ankh to add anything to a repository until you have
modified the config file to use _svn.&lt;br /&gt;&lt;br /&gt;Subversion uses a
Copy-Modify-Merge model. I was used to the CheckOut-Modify-CheckIn
model and did not want to try CMM. However, after a week of use, I
don&amp;#39;t think that I will go back. It is very nice to be able to work
when I don&amp;#39;t have an Internet connection to my repository.&lt;br /&gt;&lt;br /&gt;If
you&amp;#39;re used to VSS, get acquainted with the difference of vocabulary.
Here&amp;#39;s a quick cheat sheet:&lt;br /&gt;&lt;strong&gt;Check Out&lt;/strong&gt; - Get an
initial working copy. Only used when you&amp;#39;re setting up things on your
dev client.&lt;br /&gt;&lt;strong&gt;Export&lt;/strong&gt; - Get a clean copy of the
project. This means that the local copy with not be under source
control.&lt;br /&gt;&lt;strong&gt;Update&lt;/strong&gt; - Get the latest version. This
merges changes from the repository into your working copy. It also
merges changes into files you&amp;#39;ve modified, but does not remove your
modifications.&lt;br /&gt;&lt;strong&gt;Commit&lt;/strong&gt; - Sends your modifications
to the repository.&lt;br /&gt;&lt;br /&gt;Finally, be cautious when it comes to
renaming, deleting, or moving files.  You will want to use the
commands provided by your chosen SVN client. Using the native
functions or doing things outside of VS.NET can lead to
inconsistencies.&lt;br /&gt;&lt;br /&gt;PS&lt;br /&gt;During our Subversion setup something
caused a problem with Internet Explorer. New Windows would not open
properly. Here is an &lt;a href="http://support.microsoft.com/kb/q180176/"&gt;easy
fix&lt;/a&gt;.&lt;/p&gt;&lt;p style="margin-bottom:0in;"&gt;I also recently found msbuild&amp;nbsp; integration for Subversion at http://msbuildtasks.tigris.org/.&amp;nbsp; However, I was &amp;quot;integrating&amp;quot; previously using .bat files.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://devlicio.us/aggbug.aspx?PostID=203" width="1" height="1"&gt;</description><category domain="http://devlicio.us/blogs/christopher_bennage/archive/tags/ASP.NET/default.aspx">ASP.NET</category><category domain="http://devlicio.us/blogs/christopher_bennage/archive/tags/source+control/default.aspx">source control</category><category domain="http://devlicio.us/blogs/christopher_bennage/archive/tags/development+tools/default.aspx">development tools</category></item><item><title>Data-Binding to Methods in ASP.NET</title><link>http://devlicio.us/blogs/christopher_bennage/archive/2006/09/27/Data_2D00_Binding-to-Methods-in-ASP.NET.aspx</link><pubDate>Wed, 27 Sep 2006 14:13:00 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:147</guid><dc:creator>Christopher Bennage</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;I&amp;#39;ve run into a couple of situations where I need more than simple databinding in ASP.NET.&amp;nbsp; Sometimes I need some to bind a thing &lt;span style="font-style:italic;"&gt;conditionally&lt;/span&gt;.&lt;br /&gt;
&lt;/p&gt;
&lt;p&gt;Ok, so let&amp;#39;s say you have a collection of addresses that you want to bind to a DataList. The markup might look something like this:

&lt;/p&gt;
&lt;p&gt;

&lt;/p&gt;
&lt;div style="background:white none repeat scroll 0% 50%;font-family:Consolas;font-size:10pt;color:black;-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;
&lt;p style="margin:0px;"&gt;

&lt;/p&gt;
&lt;div style="background:white none repeat scroll 0% 50%;font-family:Consolas;font-size:10pt;color:black;-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;
&lt;p style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:maroon;"&gt;asp&lt;/span&gt;&lt;span style="color:blue;"&gt;:&lt;/span&gt;&lt;span style="color:maroon;"&gt;DataList&lt;/span&gt; &lt;span style="color:red;"&gt;ID&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;DataList1&amp;quot;&lt;/span&gt; &lt;span style="color:red;"&gt;runat&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;server&amp;quot;&amp;gt;&lt;/span&gt;&lt;/p&gt;

&lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:maroon;"&gt;ItemTemplate&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;

&lt;div style="background:white none repeat scroll 0% 50%;font-family:Consolas;font-size:10pt;color:black;-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;
&lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color:blue;"&gt;&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:maroon;"&gt;asp&lt;/span&gt;&lt;span style="color:blue;"&gt;:&lt;/span&gt;&lt;span style="color:maroon;"&gt;Panel&lt;/span&gt; &lt;span style="color:red;"&gt;ID&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;AddressPanel&amp;quot;&lt;/span&gt; &lt;span style="color:red;"&gt;runat&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;server&amp;quot;&lt;/span&gt; &lt;span style="color:red;"&gt;CssClass&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;address&amp;quot;&amp;gt;&lt;/span&gt;&lt;/p&gt;
&lt;/div&gt;&lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:maroon;"&gt;asp&lt;/span&gt;&lt;span style="color:blue;"&gt;:&lt;/span&gt;&lt;span style="color:maroon;"&gt;Label&lt;/span&gt; &lt;span style="color:red;"&gt;ID&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;Address&amp;quot;&lt;/span&gt; &lt;span style="color:red;"&gt;runat&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;server&amp;quot;&lt;/span&gt; &lt;span style="color:red;"&gt;Text&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;#39;&lt;/span&gt;&lt;span style="background:yellow none repeat scroll 0% 50%;-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;&amp;lt;%&lt;/span&gt;# Eval(&amp;quot;address&amp;quot;) &lt;span style="background:yellow none repeat scroll 0% 50%;-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;%&amp;gt;&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;#39;&lt;/span&gt; &lt;span style="color:blue;"&gt;/&amp;gt;&amp;lt;&lt;/span&gt;&lt;span style="color:maroon;"&gt;br&lt;/span&gt; &lt;span style="color:blue;"&gt;/&amp;gt;&lt;/span&gt;&lt;/p&gt;

&lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:maroon;"&gt;asp&lt;/span&gt;&lt;span style="color:blue;"&gt;:&lt;/span&gt;&lt;span style="color:maroon;"&gt;Label&lt;/span&gt; &lt;span style="color:red;"&gt;ID&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;City&amp;quot;&lt;/span&gt; &lt;span style="color:red;"&gt;runat&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;server&amp;quot;&lt;/span&gt; &lt;span style="color:red;"&gt;Text&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;#39;&lt;/span&gt;&lt;span style="background:yellow none repeat scroll 0% 50%;-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;&amp;lt;%&lt;/span&gt;# Eval(&amp;quot;city&amp;quot;) &lt;span style="background:yellow none repeat scroll 0% 50%;-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;%&amp;gt;&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;#39;&lt;/span&gt; &lt;span style="color:blue;"&gt;/&amp;gt;&amp;lt;&lt;/span&gt;&lt;span style="color:maroon;"&gt;br&lt;/span&gt; &lt;span style="color:blue;"&gt;/&amp;gt;&lt;/span&gt;&lt;/p&gt;

&lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:maroon;"&gt;asp&lt;/span&gt;&lt;span style="color:blue;"&gt;:&lt;/span&gt;&lt;span style="color:maroon;"&gt;Label&lt;/span&gt; &lt;span style="color:red;"&gt;ID&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;PostalCode&amp;quot;&lt;/span&gt; &lt;span style="color:red;"&gt;runat&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;server&amp;quot;&lt;/span&gt; &lt;span style="color:red;"&gt;Text&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;#39;&lt;/span&gt;&lt;span style="background:yellow none repeat scroll 0% 50%;-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;&amp;lt;%&lt;/span&gt;# Eval(&amp;quot;postalcode&amp;quot;) &lt;span style="background:yellow none repeat scroll 0% 50%;-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;%&amp;gt;&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;#39;&lt;/span&gt; &lt;span style="color:blue;"&gt;/&amp;gt;&lt;/span&gt;&lt;/p&gt;

&lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color:blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:maroon;"&gt;asp&lt;/span&gt;&lt;span style="color:blue;"&gt;:&lt;/span&gt;&lt;span style="color:maroon;"&gt;Panel&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;

&lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color:blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:maroon;"&gt;ItemTemplate&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;

&lt;p style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:maroon;"&gt;asp&lt;/span&gt;&lt;span style="color:blue;"&gt;:&lt;/span&gt;&lt;span style="color:maroon;"&gt;DataList&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;

&lt;/p&gt;
&lt;p&gt;Now, let&amp;rsquo;s say that you would really like to highlight all addresses where the zip code starts with &amp;quot;902&amp;quot;. Let&amp;#39;s take the AddressPanel in the ItemTemplate and bind its CssClass property like this:

&lt;/p&gt;
&lt;p&gt;

&lt;/p&gt;
&lt;div style="background:white none repeat scroll 0% 50%;font-family:Consolas;font-size:10pt;color:black;-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;
&lt;p style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:maroon;"&gt;asp&lt;/span&gt;&lt;span style="color:blue;"&gt;:&lt;/span&gt;&lt;span style="color:maroon;"&gt;Panel&lt;/span&gt; &lt;span style="color:red;"&gt;ID&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;AddressPanel&amp;quot;&lt;/span&gt; &lt;span style="color:red;"&gt;runat&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;server&amp;quot;&lt;/span&gt; &lt;span style="color:red;"&gt;CssClass&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;#39;&lt;/span&gt;&lt;span style="background:yellow none repeat scroll 0% 50%;-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;&amp;lt;%&lt;/span&gt;# Eval(&amp;quot;postalcode&amp;quot;) &lt;span style="background:yellow none repeat scroll 0% 50%;-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;%&amp;gt;&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;#39;&amp;gt; ...&lt;br /&gt;
&lt;/span&gt;&lt;/p&gt;
&lt;/div&gt;

&lt;p&gt;That gets us a little closer. It we wanted to brute force it we could create a css class for every possible zip code variation. (Yeah, okay.)
&lt;/p&gt;
&lt;p&gt;Instead, let&amp;rsquo;s create a protected method on the containing page:
&lt;br /&gt;


&lt;/p&gt;
&lt;div style="background:white none repeat scroll 0% 50%;font-family:Consolas;font-size:10pt;color:black;-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;
&lt;p style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;protected&lt;/span&gt; &lt;span style="color:blue;"&gt;string&lt;/span&gt; GetCssForPostalCode(&lt;span style="color:blue;"&gt;object&lt;/span&gt; dataItem)&lt;/p&gt;

&lt;p style="margin:0px;"&gt;{&lt;/p&gt;

&lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color:teal;"&gt;DataRowView&lt;/span&gt; row = dataItem &lt;span style="color:blue;"&gt;as&lt;/span&gt; &lt;span style="color:teal;"&gt;DataRowView&lt;/span&gt;;&lt;/p&gt;

&lt;p style="margin:0px;"&gt;&amp;nbsp;&lt;/p&gt;

&lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color:blue;"&gt;if&lt;/span&gt; (row[&lt;span style="color:maroon;"&gt;&amp;quot;postalcode&amp;quot;&lt;/span&gt;].ToString().StartsWith(&lt;span style="color:maroon;"&gt;&amp;quot;902&amp;quot;&lt;/span&gt;)) &lt;span style="color:blue;"&gt;return&lt;/span&gt; &lt;span style="color:maroon;"&gt;&amp;quot;highlight-address&amp;quot;&lt;/span&gt;;&lt;/p&gt;

&lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color:blue;"&gt;return&lt;/span&gt; &lt;span style="color:maroon;"&gt;&amp;quot;normal-address&amp;quot;&lt;/span&gt;;&lt;/p&gt;

&lt;p style="margin:0px;"&gt;}&lt;/p&gt;
&lt;/div&gt;

&lt;p&gt;We can use this method to decide what data should be bound.&amp;nbsp; So how do we connect this back to our ItemTemplate in the DataList?
The first thing to understand is that Eval() is a shortcut function for calling DataBinder.Eval(). To perform the data-binding without Eval() looks like this:
&amp;lt;%#DataBinder.Eval(Container.DataItem, &amp;quot;postalcode&amp;quot;)%&amp;gt;
I&amp;rsquo;m not sure what the proper nomenclature is for this, but the # enables the use of DataBinder as well as Container. &lt;/p&gt;
&lt;p&gt;So here&amp;rsquo;s the trick, instead of calling DataBinder.Eval() you can call your own method. In this case GetCssForPostalCode(). So the end result will look like this: 
&lt;/p&gt;
&lt;div style="background:white none repeat scroll 0% 50%;font-family:Consolas;font-size:10pt;color:black;-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;
&lt;p style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:maroon;"&gt;asp&lt;/span&gt;&lt;span style="color:blue;"&gt;:&lt;/span&gt;&lt;span style="color:maroon;"&gt;DataList&lt;/span&gt; &lt;span style="color:red;"&gt;ID&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;DataList1&amp;quot;&lt;/span&gt; &lt;span style="color:red;"&gt;runat&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;server&amp;quot;&amp;gt;&lt;/span&gt;&lt;/p&gt;

&lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:maroon;"&gt;ItemTemplate&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;

&lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:maroon;"&gt;asp&lt;/span&gt;&lt;span style="color:blue;"&gt;:&lt;/span&gt;&lt;span style="color:maroon;"&gt;Panel&lt;/span&gt; &lt;span style="color:red;"&gt;ID&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;AddressPanel&amp;quot;&lt;/span&gt; &lt;span style="color:red;"&gt;runat&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;server&amp;quot;&lt;/span&gt; &lt;span style="color:red;"&gt;CssClass&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;#39;&lt;/span&gt;&lt;span style="background:yellow none repeat scroll 0% 50%;-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;&amp;lt;%&lt;/span&gt;#GetCssForPostalCode(Container.DataItem)&lt;span style="background:yellow none repeat scroll 0% 50%;-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;%&amp;gt;&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;#39;&amp;gt;&lt;/span&gt;&lt;/p&gt;

&lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:maroon;"&gt;asp&lt;/span&gt;&lt;span style="color:blue;"&gt;:&lt;/span&gt;&lt;span style="color:maroon;"&gt;Label&lt;/span&gt; &lt;span style="color:red;"&gt;ID&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;Address&amp;quot;&lt;/span&gt; &lt;span style="color:red;"&gt;runat&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;server&amp;quot;&lt;/span&gt; &lt;span style="color:red;"&gt;Text&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;#39;&lt;/span&gt;&lt;span style="background:yellow none repeat scroll 0% 50%;-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;&amp;lt;%&lt;/span&gt;# Eval(&amp;quot;address&amp;quot;) &lt;span style="background:yellow none repeat scroll 0% 50%;-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;%&amp;gt;&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;#39;&lt;/span&gt; &lt;span style="color:blue;"&gt;/&amp;gt;&amp;lt;&lt;/span&gt;&lt;span style="color:maroon;"&gt;br&lt;/span&gt; &lt;span style="color:blue;"&gt;/&amp;gt;&lt;/span&gt;&lt;/p&gt;

&lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:maroon;"&gt;asp&lt;/span&gt;&lt;span style="color:blue;"&gt;:&lt;/span&gt;&lt;span style="color:maroon;"&gt;Label&lt;/span&gt; &lt;span style="color:red;"&gt;ID&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;City&amp;quot;&lt;/span&gt; &lt;span style="color:red;"&gt;runat&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;server&amp;quot;&lt;/span&gt; &lt;span style="color:red;"&gt;Text&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;#39;&lt;/span&gt;&lt;span style="background:yellow none repeat scroll 0% 50%;-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;&amp;lt;%&lt;/span&gt;# Eval(&amp;quot;city&amp;quot;) &lt;span style="background:yellow none repeat scroll 0% 50%;-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;%&amp;gt;&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;#39;&lt;/span&gt; &lt;span style="color:blue;"&gt;/&amp;gt;&amp;lt;&lt;/span&gt;&lt;span style="color:maroon;"&gt;br&lt;/span&gt; &lt;span style="color:blue;"&gt;/&amp;gt;&lt;/span&gt;&lt;/p&gt;

&lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:maroon;"&gt;asp&lt;/span&gt;&lt;span style="color:blue;"&gt;:&lt;/span&gt;&lt;span style="color:maroon;"&gt;Label&lt;/span&gt; &lt;span style="color:red;"&gt;ID&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;PostalCode&amp;quot;&lt;/span&gt; &lt;span style="color:red;"&gt;runat&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;quot;server&amp;quot;&lt;/span&gt; &lt;span style="color:red;"&gt;Text&lt;/span&gt;&lt;span style="color:blue;"&gt;=&amp;#39;&lt;/span&gt;&lt;span style="background:yellow none repeat scroll 0% 50%;-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;&amp;lt;%&lt;/span&gt;# Eval(&amp;quot;postalcode&amp;quot;) &lt;span style="background:yellow none repeat scroll 0% 50%;-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;%&amp;gt;&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;#39;&lt;/span&gt; &lt;span style="color:blue;"&gt;/&amp;gt;&lt;/span&gt;&lt;/p&gt;

&lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color:blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:maroon;"&gt;asp&lt;/span&gt;&lt;span style="color:blue;"&gt;:&lt;/span&gt;&lt;span style="color:maroon;"&gt;Panel&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;

&lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color:blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:maroon;"&gt;ItemTemplate&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;

&lt;p style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:maroon;"&gt;asp&lt;/span&gt;&lt;span style="color:blue;"&gt;:&lt;/span&gt;&lt;span style="color:maroon;"&gt;DataList&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin:0px;"&gt;&amp;nbsp;&lt;/p&gt;


&lt;/div&gt;
&lt;p style="margin:0px;"&gt;Also see Rob Eisenberg&amp;#39;s &lt;a href="http://devlicio.us/blogs/rob_eisenberg/archive/2006/09/22/.NET-3.0-Crash-Course-_1320_-Part-1_3A00_-Introduction.aspx"&gt;series of posts&lt;/a&gt; on .NET 3.0 to learn how WPF addresses this problem (though not for the Web).&lt;br /&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://devlicio.us/aggbug.aspx?PostID=147" width="1" height="1"&gt;</description><enclosure url="http://devlicio.us" length="300301" type="application/zip" /><category domain="http://devlicio.us/blogs/christopher_bennage/archive/tags/ASP.NET/default.aspx">ASP.NET</category><category domain="http://devlicio.us/blogs/christopher_bennage/archive/tags/DataBinding/default.aspx">DataBinding</category></item><item><title>The Castle Project/MonoRail</title><link>http://devlicio.us/blogs/christopher_bennage/archive/2006/09/20/The-Castle-Project_2F00_MonoRail.aspx</link><pubDate>Thu, 21 Sep 2006 01:33:00 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:32</guid><dc:creator>Christopher Bennage</dc:creator><slash:comments>3</slash:comments><description>&lt;p&gt;If you do any Web development whatsoever then you have most likely heard of &lt;a href="http://www.rubyonrails.com/"&gt;Ruby
on Rails&lt;/a&gt;. Ruby is a dynamic programming language and Rails is a framework
for Web development. It&amp;#39;s analogous to saying C# on ASP.NET. Well, the Rails
framework is impressive to me in its own right. Even after just hearing some
friends discuss it, my mind immediately began to try to apply the ideas to
.NET. Luckily, I stumbled across the &lt;a href="http://www.castleproject.org/"&gt;Castle Project&lt;/a&gt;. Castle is a rich,
open source project that offers a great many things. One of those things is
MonoRail, a port of Rails to the .NET framework.&lt;br /&gt;
&lt;br /&gt;
Rails and MonoRail are both built around the &lt;a href="http://en.wikipedia.org/wiki/Model-view-controller"&gt;Model-View-Controller&lt;/a&gt;
pattern. (As opposed to the &lt;a href="http://www.martinfowler.com/eaaCatalog/pageController.html"&gt;Page
Controller&lt;/a&gt; pattern that &lt;a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnpatterns/html/ImpPageController.asp"&gt;ASP.NET
claims to built around&lt;/a&gt;.)&lt;/p&gt;

&lt;p&gt;My initial forays into MonoRail have been promising and I really hope the
project&amp;#39;s community continues to grow. &amp;nbsp;&lt;/p&gt;

&lt;p&gt;I will warn you, if you begin to play with MonoRail you will begin to hate
the Page lifecycle in ASP.NET.&lt;br /&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://devlicio.us/aggbug.aspx?PostID=32" width="1" height="1"&gt;</description><category domain="http://devlicio.us/blogs/christopher_bennage/archive/tags/ASP.NET/default.aspx">ASP.NET</category><category domain="http://devlicio.us/blogs/christopher_bennage/archive/tags/Design+Patterns/default.aspx">Design Patterns</category><category domain="http://devlicio.us/blogs/christopher_bennage/archive/tags/RoR/default.aspx">RoR</category><category domain="http://devlicio.us/blogs/christopher_bennage/archive/tags/Castle+Project/default.aspx">Castle Project</category></item><item><title>My History With 3rd Party Controls</title><link>http://devlicio.us/blogs/christopher_bennage/archive/2006/09/20/My-History-With-3rd-Pary-Controls.aspx</link><pubDate>Thu, 21 Sep 2006 01:18:00 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:27</guid><dc:creator>Christopher Bennage</dc:creator><slash:comments>7</slash:comments><description>&lt;p&gt;The following is a series of posts I made on my old blog regarding control suites. I think it should be an interesting read for anyone evaluating a 3rd party control suite.&amp;nbsp; Be sure to read both posts.&lt;/p&gt;&lt;p&gt;&lt;em&gt;March 31st, 2006&lt;/em&gt;&lt;br /&gt;&lt;strong&gt;The Honeymoon Is Over: My Farewell to 3rd Party Controls&lt;/strong&gt; &lt;br /&gt;&lt;/p&gt;&lt;p&gt;Over the last couple of years I have used web controls suite from &lt;a href="http://www.infragistics.com/"&gt;Infragistics &lt;/a&gt;and &lt;a href="http://www.telerik.com/"&gt;Telerik&lt;/a&gt;.
I was a very enthusiastic user, and I think that I could have been a
product evangelistic for Telerik about 9 months ago. Telerik seems to
have an especially agressive development cycle and they deliver new
products every couple of months.&lt;br /&gt;&lt;br /&gt;So what happened?&lt;br /&gt;Well, the whiz-bang wore off and I began to realize the following deficits:&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;strong&gt;Inadequate Documentation&lt;/strong&gt;.
3rd party never seem to be documented well. Sure, there&amp;#39;s lot of
documentation for both Infragistrics and Telerik, but that doesn&amp;#39;t mean
it&amp;#39;s good documentation. I can&amp;#39;t come down on them too hard. My wife is
a tech writer and I understand the difficulties of writing good
documentation. However, I can never seem to find what I need. Which
leads to the next problem...&lt;/li&gt;&lt;li&gt;&lt;strong&gt;Inconsistent API&amp;#39;s&lt;/strong&gt;.
I personally try to follow Microsoft&amp;#39;s guidlines and examples. I want a
.NET developer reviewing my code to feel &amp;quot;at home&amp;quot;, like my code is a
natural part of the framework itself. Now, I understand that 3rd
parties may have excellent reasons for establishing their own feel.
However, both API&amp;#39;s are inconsistent even within themselves. Don&amp;#39;t
expect methods that do the same thing on different controls to have the
same name. I feel like I have to become an expert with each and every
control.&lt;/li&gt;&lt;li&gt;&lt;strong&gt;Bulk&lt;/strong&gt;. Too many features. Does that
sound backwards? I spend a lot of my time figuring out how to minimize
what the control does. Take Telerik&amp;#39;s rich text editor; it rivals Word.
Additionally, the acutal HTML rendered for many of these controls is
expansive. I&amp;#39;ve ended up writing a number of simple controls,with
simple output just because using a 3rd party control seemed excessive.&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;I
will say a positive thing about 3rd party controls. If you have a
relativity simple application to development, and you want very rich
client functionality, these suites will benefit you. However, if you
are writing commericial applications for a wide audience, and if
performance is an issue, then I would recommend being a bit more wary.&lt;/p&gt;&lt;p&gt;&lt;em&gt;April 9th, 2006&lt;/em&gt;&lt;br /&gt;&lt;strong&gt;Telerik Responds&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;I was surprised and somewhat humbled last week to receive an email from
the CEO of Telerik, Vassil Terziev. He had come across my blog post where I criticize 3rd party control suites and wanted to respond.&lt;br /&gt;To
summarize, he was very cordial and acknowledged each of my complaints
as valid. He explained that Telerik has recently changed a few things
about their development cycle in order to improve upon the weaknesses I
listed. He also pointed out a few things Telerik has already
accomplished to those ends (such as a 70% reduction in output from
their tabstrip product).&lt;br /&gt;His email was personal, friendly, and
transparent about his products. I was very impressed and the fact that
Telerik has that kind of leadership encourages me to give their
products another chance.&lt;br /&gt;Luckily, my employer&amp;#39;s subscription to
their control suite still has many months left. Expect me to post my
reflections upon the updated Telerik products when they arrive. &lt;/p&gt;&lt;p&gt;&lt;em&gt;September 20th, 2006&amp;nbsp;&lt;/em&gt;&lt;/p&gt;&lt;p&gt;I never did get around to really evaluating the improvements that Vassil listed.&amp;nbsp; We did continue to use there controls and I have continued to be impressed&amp;nbsp; with their attention to customer input.&amp;nbsp; I have had some performance issues with the rich text editor, though mostly in an environment with multiple instances of the editor on a single page.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://devlicio.us/aggbug.aspx?PostID=27" width="1" height="1"&gt;</description><category domain="http://devlicio.us/blogs/christopher_bennage/archive/tags/ASP.NET/default.aspx">ASP.NET</category><category domain="http://devlicio.us/blogs/christopher_bennage/archive/tags/Product+Reviews/default.aspx">Product Reviews</category><category domain="http://devlicio.us/blogs/christopher_bennage/archive/tags/Telerik/default.aspx">Telerik</category></item><item><title>Custom Fields for GridView Tips</title><link>http://devlicio.us/blogs/christopher_bennage/archive/2006/09/20/Custom-Fields-for-GridView-Tips.aspx</link><pubDate>Thu, 21 Sep 2006 00:41:00 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:26</guid><dc:creator>Christopher Bennage</dc:creator><slash:comments>0</slash:comments><description>
&lt;p&gt;This is a followup to &lt;a href="http://devlicio.us/blogs/christopher_bennage/archive/2006/09/19/DropDownField-for-GridView.aspx"&gt;my post&lt;/a&gt; on creating a DropDownField for the GridView control. Just a couple of tips for anyone else who might be developing custom columns for the GridView.&amp;nbsp; If you don&amp;#39;t care about customizing the GridView, don&amp;#39;t bother reading this.&lt;br /&gt;
&lt;/p&gt;

&lt;p&gt;&lt;span style="font-style:italic;"&gt;Tip #1 - Respect the Page Lifecycle&lt;/span&gt;&lt;br /&gt;
&lt;/p&gt;

&lt;p&gt; The distinction between the two methods I mentioned previously,&amp;nbsp; &lt;strong&gt;InitializeDataCell &lt;span style="font-weight:normal;"&gt;and &lt;/span&gt;&lt;/strong&gt;&lt;strong&gt;OnDataBindField&lt;span style="font-weight:normal;"&gt;, was vague to me at first.&amp;nbsp; It didn&amp;#39;t seem to matter which method I used for creating controls to insert into the GridView. Now, I&amp;#39;m a little wiser.&amp;nbsp; You want to instantiate your controls in InitializeDataCell so that their change events will fire, if you want and instantiate them in OnDataBindField it will be to late.&amp;nbsp; Additionally, you will not be able to access the bound data until the DataBinding event, thus the need for the second method.&lt;/span&gt;&lt;/strong&gt;
&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Tip #2 - Beware of Adding Members to DataControlFieldCell&lt;/em&gt; &lt;/p&gt;

&lt;p&gt;There is only one instance of field defined in a GridView regardless of the number of rows. When I first attempted to create a custom field, I inherited from DataControlFieldCell and added a private member of type &lt;strong&gt;&lt;span style="font-weight:normal;"&gt;TextBox &lt;/span&gt;&lt;/strong&gt;called EditControl.&amp;nbsp; I set EditControl in &lt;strong&gt;&lt;span style="font-weight:normal;"&gt;InitializeDataCell to a new TextBox, and set the .Text property in OnDataBindField.&amp;nbsp; My first test only had one row of data in the GridView and everything seemed to work.&amp;nbsp; My second test had many rows of data, and it no longer worked.&amp;nbsp; I discovered that my &lt;/span&gt;&lt;/strong&gt;EditControl&lt;strong&gt;&lt;span style="font-weight:normal;"&gt; field was being shared across every row, because there is only one instance of the each field.&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The solution was to&amp;nbsp; do something like this:&lt;/p&gt;

&lt;div&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; protected override void InitializeDataCell(DataControlFieldCell cell, DataControlRowState rowState)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cell.DataBinding += OnDataBindField;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if ((rowState &amp;amp; DataControlRowState.Edit) != DataControlRowState.Normal)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cell.Controls.Add(new TextBox());&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; } &lt;br /&gt;
&lt;/div&gt; and &lt;br /&gt;

&lt;div&gt;	protected override void OnDataBindField(object sender, EventArgs e)&lt;br /&gt;
        {&lt;br /&gt;
            DataControlFieldCell cell = (DataControlFieldCell) sender;&lt;br /&gt;
&lt;br /&gt;
            string myBoundData = GetValue(cell.NamingContainer).ToString();&lt;br /&gt;
&lt;br /&gt;
            if ((rowState &amp;amp; DataControlRowState.Edit) != DataControlRowState.Normal)&lt;br /&gt;
            {&lt;br /&gt;
                (cell.Controls[0] as TextBox).Text = myBoundData;&lt;br /&gt;
            }&lt;br /&gt;
            else&lt;br /&gt;
            {&lt;br /&gt;
                cell.Text = myBoundData;&lt;br /&gt;
            }&lt;br /&gt;
        } &lt;br /&gt;
&lt;br /&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://devlicio.us/aggbug.aspx?PostID=26" width="1" height="1"&gt;</description><category domain="http://devlicio.us/blogs/christopher_bennage/archive/tags/ASP.NET/default.aspx">ASP.NET</category><category domain="http://devlicio.us/blogs/christopher_bennage/archive/tags/Custom+Control/default.aspx">Custom Control</category><category domain="http://devlicio.us/blogs/christopher_bennage/archive/tags/GridView/default.aspx">GridView</category></item><item><title>DropDownField for GridView</title><link>http://devlicio.us/blogs/christopher_bennage/archive/2006/09/19/DropDownField-for-GridView.aspx</link><pubDate>Wed, 20 Sep 2006 01:33:00 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:19</guid><dc:creator>Christopher Bennage</dc:creator><slash:comments>4</slash:comments><description>&lt;p&gt;
One of the requirements on my current project involves the user
defining what a grid of data should look like. We allow a user to
create a &amp;quot;definition&amp;quot;, which we persist in the database and then we
construct a &lt;a href="http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview.aspx"&gt;GridView&lt;/a&gt;
at runtime based on the &amp;quot;definition&amp;quot;. This mean that we don&amp;#39;t know what
fields (or even types of fields) the GridView has at design time.
Additionally, we needed to support drop down lists in the GridView.&lt;/p&gt;&lt;p&gt;
I searched for a good while hoping to find out how to programmatically
add a drop down list to a GridView. All of the examples I found used a &lt;a href="http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.templatefield.aspx"&gt;TemplateField &lt;/a&gt;and were based on the assumption that you knew you wanted a drop down list at design time.

So I decided to build my own custom drop down list field. &lt;a href="http://www.aisto.com/roeder/dotnet/"&gt;Reflector&lt;/a&gt; allowed me to dissect the various fields that shipped with the framework (&lt;a href="http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.boundfield.aspx"&gt;BoundField&lt;/a&gt;, &lt;a href="http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.boundfield.aspx"&gt;CheckBoxField&lt;/a&gt;, etc.) All of these classes derive from &lt;a href="http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.datacontrolfield.aspx"&gt;DataControlField&lt;/a&gt;. I won&amp;#39;t go into too much more detail for the moment, but the major members that I had to implement for DataControlField were:&lt;/p&gt;

&lt;ul&gt;&lt;li&gt;InitializeDataCell&lt;/li&gt;&lt;li&gt;OnDataBindField&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;strong&gt;InitializeDataCell&lt;/strong&gt;
determines the state of the current row in the GridView (is it edit or
readonly). Then it instantiates the appropriate controls. In my case,
the default &lt;a href="http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.datacontrolfieldcell.aspx"&gt;DataControlFieldCell&lt;/a&gt; for read-only and a (you guessed it) &lt;a href="http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.dropdownlist.aspx"&gt;DropDownList &lt;/a&gt;for edit. Additionally, it wires up the DataBinding event for the control it just added.&lt;/p&gt;&lt;p&gt;&lt;strong&gt;OnDataBindField&lt;/strong&gt;
is responsible for putting the right value in the control. In my case,
we check to see whether or not we have a drop down list and if we do,
then we apply some logic to populate the items in that list. An
interesting point here is that you want to instantiate new &lt;a href="http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.listitem.aspx"&gt;ListItems&lt;/a&gt;
for every row. If you only have one set of ListItems you will end up
with odd behavior, because multiple DropDownLists will be referencing
the same exact ListItems.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://devlicio.us/aggbug.aspx?PostID=19" width="1" height="1"&gt;</description><enclosure url="http://devlicio.us" length="452207" type="application/zip" /><category domain="http://devlicio.us/blogs/christopher_bennage/archive/tags/ASP.NET/default.aspx">ASP.NET</category><category domain="http://devlicio.us/blogs/christopher_bennage/archive/tags/Custom+Control/default.aspx">Custom Control</category><category domain="http://devlicio.us/blogs/christopher_bennage/archive/tags/GridView/default.aspx">GridView</category></item></channel></rss>