Re: DropDownList and Spaces




"Mariela Donkova" <mariela@xxxxxxxxxxxxxxxxxxx> wrote in message
news:eR2g0fSOGHA.3924@xxxxxxxxxxxxxxxxxxxxxxx
Hi everyone ,

I have a simple question :

How to display in a dropdownlist names which have spaces at the begining.
for example :
MainCategory
subcategory
subsubcategory
subsubsubcategory
I am trying to keep hierarchy using spaces in dropdownlist
Regards,
Mariela

Here is a solution that was posted some time ago to add space in lists.

<%@ Page Language="VB" Debug="true" %>
<script language=VB runat=server>

Sub Page_Load(Sender As Object, E As EventArgs)

Dim Padding As String
Dim writer As New System.IO.StringWriter()
Dim DecodedString As String

Padding = "&nbsp;&nbsp;"
Server.HtmlDecode(Padding, writer)
Padding = writer.ToString()

myDropDownList2.Items.Add(Padding & " MVP's")

Padding = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"
Server.HtmlDecode(Padding, writer)
Padding = writer.ToString()

myDropDownList2.Items.Add(Padding & " MVP's")

myDropDownList2.Items.Add("MVP's" & Padding & "Do Their best")

End Sub

</script>
<html>
<head><title>Padding DropListBox</title></head>
<body><form fred runat="server"><asp:dropdownlist id="MyDropDownList2"
runat="server"/></form></body>
</html>

Mike


.