char nbsp = (char)0xA0;
for ( int i=0 ; i < 5 ; ++i )
{
ddl3.Items.Add(new ListItem("Level 0".PadLeft(i+7, nbsp) + i, i.ToString()));
}
生成的客户端代码为:
<select>
<option value="0">Level 00</option>
<option value="1"> Level 01</option>
<option value="2">  Level 02</option>
<option value="3">   Level 03</option>
<option value="4">    Level 04</option>