.net Column Layout Control


With the CSS3 spec now underway, lots of new tools for site layout are just around the corner; one of which is the ability to define text to be layed out in columns. However, with no set date as to when CSS3 will be finished, and then no way to know when everyone will have a browser which fully supports the standard, this recently left me with a bit of a problem in a recent project which required database driven text to be layed out across 3 columns on the page.

However I managed to find a dot net control which achieved just that; The Multicolumn layout control, on tomasp.net.  Once the dll is dropped in the bin folder and a reference added to the top of the page, it's very easy to use- 

<cc:ColumnControl ColumnCount="3" runat="server" id="ColumnControl1">
.. your original long html content ..
</cc:ColumnControl>

Alternatively, you can drop the control on the page, and add the content through the code behind using sytax like

ColumnControl1.controls.add(
  new Literal("<strong> My Html goes here! </strong>")
);

I attached a literal control, which i put the entire content from my databases HTML field.  Apparently you can even dump in a repeater control in there to have the content from that automatically spanned across the columns.

Only small gotcha I found on this was that occasionally it would chop the last full stop in my HTML content, and start the next column with just a full stop- however i think thisis more down to the poor quality data i have to work with- i managed to fix this by ensuring there are no spaces before any full stops, and always one space after- which was easily done using a replace statement.

Related posts:

  1. No comments yet.
(will not be published)
  1. No trackbacks yet.