CSS Positioning – Return of the Browser Wars?

A la A List Apart, I have been updating my presentation layer coding techniques to be compliant with modern XHTML and CSS standards. While I can certainly appreciate that adhering to these standards results in cleaner code that is easier to maintain, I have found that where element posisitioning is concerned I end up mired in a cross-browser compatibility nightmare the likes of which I haven’t been in since the days of the browser wars. Using nested HTML tables for page layout always bothered me in that it violated the principle of seperating content from structure and presentation. However, using CSS floating (I don’t use absolute positioning) to make a multiple-column page layout takes some masterful coding and/or use of hacks to make it work in multiple browsers! At least browsers can agree on how to render a table. Ever notice how so many of these starndards-compliant sites display all their text in one column centered on the page?

Below are some good resources on the subject, and some code generators for css layouts (the whole notion of a code generator for something as simple as a 3 column layout can take some getting used to – and don’t even think about more than 3 columns). Unfortunately, I wasn’t always successful in backing this code into existing site templates that I’ve made. So until I master the dreaded CSS float, I think I’ll have to keep the occasional table around for layout purposes.

CanVS Macros Save You from Carpal Tunnel?

I am currently writing my ASP.Net pages in VB.Net since my client comes from the ASP/VBScript tradition and the VB syntax is more familiar to them. It hasn’t taken long for me to miss the terse syntax of C#, especially since I have mild tendonitus and typing all those End X is killing me. Properties are the worst. Even though VS.Net will complete properties that you start in VB, you still have to write one line for each to get them started. So I looked to the web for a solution to this problem, and low and behold, I found this great article by Scott Mitchelle on using VS.Net macros to write properties.

I took this concept and expanded it by writing a macro that will write the property shells for all the private member reocords you have selected. Click here to download the macro.

"Tech" PodCasts

I’m surprised how hard it is to find a good tech PodCast that talks about coding and best practices. I stumbled upon Craig Shoemaker’s Polymorphic PodCast first, and haven’t found anything that comes close to the quality of its content since. I think his show should make it somewhere higher thank #27 on Podcast Alley’s list of top tech podcasts. Of course, I’m going to be biased towards shows that cover the technologies I develop in (.Net, Oracle, etc.) so perlcast and anything with mac in the title are out for me. But half the shows on that list are mostly music (i.e. daily source code).

Too bad the .Net show won’t podcast just because the word "pod" is in the title.

Trimming down that ViewState

I’m developing an ASP.Net site for a client that is very concerned about bandwidth. My first objective is to reduce the size of the hidden veiwstate data returned in the form.

The worst culprits seem to be the data display controls, especially the DataGrid. I found that for displaying small amounts of data in a table (20 rows by 5 columns) the page with a DataGrid returned over twice as much view state data (5,716 bytes vs 2,512 bytes) as one using a Repeater to render the table.

Worse yet, once I started returning larger amounts of data, even the Repeater was generating a heafty amount of veiw state data. Since these pages are essentially run once search result pages, I’ve added the following to the Page directive

EnableViewState=”false”

ASP.Net still returns view state data for the page, but only a small amount. To completely remove it from the page, you have to remove all runat=”server” tags.

The following article also shows how to trim the ViewState data on a control by control basis:

http://www.codeproject.com/aspnet/hmvsiooc.asp