For a project I’m working on in my spare time, I’m trying to get my head around ASP.NET 2.0 and, of course, AJAX.
Not too long ago I thought I had reasonable understanding of the ASP.NET page processing flow and data binding. Now that I’m putting this belief to the test, it goes to show nothing’s as easy as it seems.
Usually, Microsoft is quite good at providing abstractions that make simple things easy and hard things possible. However, I came to learn that, especially for the latter part, ASP.NET 2.0 data-bound controls seem to have failed in providing useful and intuitive abstractions.
It’s so that I can’t seem to be able to drag-and-drop together a simple master-detail editing page for a single master record and an open number of detail records. None of the 2.0 controls is helping, short of what I would have to do using a Repeater.
I want to insert and edit, but maintaining all Insert, Read-only and Edit templates is cumbersome, and almost impossible with increasingly complex templates. Why, oh, why is there no simple way to build data-bound "Web User Template" controls?
And I want bulk-edits (think Excel). The notion (and UI experience) of single-row edits drives me crazy. While I have been looking left and right for some simple solution, it’s not until today that I found some relief in Matt Dotson’s Real World GridView.
But it is a GridView, and I would rather go with a DataList or even simpler control with the capability to disable some controls for one or the other data row. So I have to go and apply Matt’s approach to a subclass of DataList or even Repeater.
To reduce clutter, especially when there’s a couple of drop-downs for each row of data, AJAX is an obvious solution and there’s a lot of stuff in the AJAX toolkit that makes my life easier in other places as well. For instance, using AJAX makes the Back-and-Forward-Experience much cleaner. However, using AJAX in (and across) templated data-bound controls is far from obvious or simple. How do you debug something that doesn’t render, i.e. code that doesn’t run?
So, to me, it seems I’m looking for (or applying) the wrong abstractions. Or, Microsoft’s data-bound controls are, although complicated with all that templating, only means for collecting low-hanging fruits and so are the AJAX controls.
A friend, who’s working with me on the project, burdened with using CSS and themes to fix the UI mess I create, has a rich experience using PHP. Other than for Master pages ("Ahh, Server-Side-Includes!"), he’s giving me a hard time when I try to convey the whole ASP.NET 2.0 "little or no page code" concept. Especially, when I need two weeks to find out how to assemble all-fancy controls to generate 50 lines of ugly-as-hell XHTML.
Well, at least my failures are declarative.