Not much blogging this week...here's what I've been rambling about lately.
I've had my head down in ASP.NET and the Data Grid control. Our eFinance Application Server makes extensive use of what I like to call "strongly-typed XML" (XML with associated XSDs/XML Schema) and I've been doing lots of lovely DataGrids with Sorting, Filtering, etc as well as some dynamic charts.
I'm also deep in my most favorite (or is that favourite?) namespace, System.Globalization. It's just so well thought out. Lots of great stuff in here and much use of ISO standards like ISO 4217 for currency and number formatting (JPY, USD, GBP, ZWD, etc) and ISO 3166 for country codes (JP, US, GB, ZW, etc)...see a pattern? I'm one of those dorks that dug the Dewey Decimal System and I dig nice ordered category systems now.
One interesting thing, I'm running into a bit of trouble with number formatting, which I would have preferred to relegate entirely to the ASPX page...as if the ASPX page were truly the "View" to my Code-Behind "Controller." While that's the dream, it's hardly the reality. This kind of formatting creeps into my code-behinds, and leaps in to them when dealing with culture-specific data input.
Things get so mixed up between ASPX and Code-Behind on a moderately complex ASP.NET page (considering a multi-lingual site and multi-currency-in-one-grid situation), once you factor in DataBinding Eval() statements, Totals in Footers, Sorting and Filtering, it really makes me question the whole ASP.NET code-behind paradigm. Sometimes my DataGrid event handlers feel better on the OnEventWhatever attributes of the DataGrid tag in the ASPX, and sometimes I just hook them up ala C# += EventHandlers in InitializeComponent(). Even Dino Esposito, a prolific writer on the DataGrid, puts page formatting all over the place in code-behinds (at the bottom) in his articles (although I take all article code with a mountain-sized grain of salt) apparently because there's just no other way to do it.
Is elegance possible?
alternately, it's 1am and time for bed. In conclusion, I will say this: I can get more done in ASP.NET in a day than I could in Classic ASP in a fortnight and I don't have that lingering sense of next-morning shame that came with a truly horrendous ASP hack - and Fritz Onion played no small part in this personal achievement.
Other than building my own reverse-lookup hashtable at Application.Start, does anyone seen an obvious (or not obvious) and fast way given a currency string ("USD", etc) to get a CultureInfo and a NumberFormatInfo? Perhaps I'm missing something obvious.
UPDATE: Peter Provost has a eye-opening reply post about this topic that makes a lot of sense to me. If I start thinking about ASPX files and code-behinds as two sides of the same coin, then more "classical" MVC architectures fit nicely into the ASP.NET model. I was stuck on what I felt was lack of elegance in interface between the two. I'll try suspending belief for a bit and see what comes of it... :)