setting tabs in a string

G

Guest

Hi,

I am filling a server side listbox in an asp.net app
Each text value for each item in the list is created by concatenating to
string values together.

I want to give the appearance of columns in the drop down list box.
i.e.
jan 2000
feb 2000
mar 2000

however I am getting :
jan 2000
feb 2000
mar 2000
in the list box.

any ideas how to format them so they are nice and cleanly creating columns?
P.S: adding a string with spaces in the middle does nothing.

item.text = string1 & " " & string2
this still only gives 1 space between the two.


thanks

Chris
 
J

jjardine

Chris said:
Hi,

I am filling a server side listbox in an asp.net app
Each text value for each item in the list is created by concatenating to
string values together.

I want to give the appearance of columns in the drop down list box.
i.e.
jan 2000
feb 2000
mar 2000

however I am getting :
jan 2000
feb 2000
mar 2000
in the list box.

any ideas how to format them so they are nice and cleanly creating
columns?
P.S: adding a string with spaces in the middle does nothing.

item.text = string1 & " " & string2
this still only gives 1 space between the two.


thanks

Chris

Unfortunately I don't know as though there is a way to do this. HTML only
allows one white space untless you use   Unfortunately the List
Box will HTMLEncode the   string and actually display that. If you can
use a visible character you can use like a "_" or something to seperate the
columns. Also remember that if the font you are using is not a fixed width
font no matter what character you use the columns will not line up
correctly.
 
G

Guest

Hi Chris,

I have a small workaround. In case you are binding the values to the drop
down from a SQL Query / Stored procedure, then you can use this. In SQL Query
use

Column A + ' ' + Column B as Column C

And now bind it to the list box.

In case this dosent help, do post a msg back and we shall see abt it.


Happy Coding
 
B

Bill Richardson

Not sure how this works in .net but in ASP you can add a &nbsp which
will force a space.

optionString="jan &nbsp&nbsp&nbsp 2000"
would force 3 more spaces into the string.
not sure if theres a code for tab but im sure it would the same.
assuming this is valid in .net
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top