Whitespace sequence
Q:
My ComboBox contains sequences of whitespaces which are collapsed to a single space. For example "Item 1" and "Item 1" are displayed identical in the list ("Item 1"). Is there a way to solve this problem?
A:
The ComboBox stores the correct number of white spaces in its items, but the browsers display a single space for an entire sequence. A simple solution would be to use an item template to replace the spaces with a " " character:
<obout:ComboBox runat="server" ID="ComboBox1">
<Items>
<obout:ComboBoxItem runat="server" Text="Item 1" />
<obout:ComboBoxItem runat="server" Text="Item 1" />
<obout:ComboBoxItem runat="server" Text="Item 1" />
</Items>
<ItemTemplate>
<%# Container.Text.Replace(" ", " ") %>
</ItemTemplate>
</obout:ComboBox>
This solution will work fine even if you populate the items from a database (or a different data source).
|