I guess it's about time I've posted again.  I've been very busy.  Just coming up for air for a bit.

I've been mixing some CSS design patterns with Server Controls recently. 

Aside: A nice book about CSS design patterns is Pro CSS and HTML Design Patterns.  It is very helpful in understanding how the boxing models work and it provides a lot of practical examples.

Anyway, copy-paste reuse easily gets out of hand on a web project.  It's not always easy to refactor HTML.  Anyway, I have many pages that use the "rollup" (collapsible) pattern in the HTML.  The pattern involves a few elements and I found myself copying those elements over and over.  Eventually, I said, enough is enough.  I took the pattern and wrapped it in a server control that renders all of the html elements for me.  Then on my pages, I just have to set a few properties and add my content and I am done.  Taking this approach on a couple of other HTML patterns has helped me reduce the nesting levels in my pages easily by half.

I plan to write an article about my experience with this.  I am fairly new to component writing, so it took me a while to get everything working right (including the custom designer).  In fact, I am still struggling with an interesting "bug" that adds no-break-space ( ) to my content inside my control?  This only happens in design mode, so, I must have done something wrong.

Anyhow, whether I figure out the designer mode issue or not, I will write up my path to semi-enlightenment.  It will just have to wait until after this cloud (initial client deployment) looming over my head let's some light through.

posted on Thursday, April 17, 2008 4:26 PM
Filed Under [ .Net Design Design Principles CSS ]


No comments posted yet.

Post A Comment