Albert Casey gave me a great solution (OK HACK) to this problem yesterday.

Problem:

In ASP.NET 1.1, how do I display a multicolumn dropdownlist using the asp:dropdownlist control? Whitespace and &nbsp dont work.

Reason for problem:

The <option>

html element discards multiple whitespace that are used to pad column widths. You cant use    as whitespace because ASP.NET html-encodes the whole response stream, ie &nbsp becomes &amp;&nbsp; on the client.

Solution:

In your server side code, use the \u00A0 character as your padding character. Create calculated columns in your data table to set as the text field for the dropdownlist

eg, in the following, a 2 column drop down is required that has the first column 30 chars wide including padding:

char nbsp2 = ‘\u00A0′ ; // no-break space
char string pad = new string( nbsp2, 30 ) ;
DataTable dt = your data table ;
dt.Columns.Add( “uiTextFieldTemp1″, typeof(string), “SUBSTRING(col1,1,30)” ) ;
dt.Columns.Add( “uiTextFieldTemp2″, typeof(string), “SUBSTRING(‘” + pad + “‘, 1, 30 – Len(uiTextFieldTemp1) )” ) ;
dt.Columns.Add( “uiTextField”, typeof(string), “uiTextFieldTemp1 + uiTextFieldTemp2 + col2″ ) ;
dropdownlist.DataSource = dt.DefaultView ;
dropdownlist.DataValueField = “keyField” ;
dropdownlist.DataTextField = “uiTextField” ; dropdownlist.DataBind() ;