Right align text in a DropDownList

J

Joel

I have data from a table that must be strings, not numbers, but I would like
to display it in a DropDownList WebControl right aligned. I tried using the
DataTextFormatString but with no luck. Any ideas?

TIA

</joel>
 
P

Philip Q [MVP]

Sadly, you do not have much control over the display of text in a
DropDownList in ASP.NET, HTML or CSS.
One method that you could try would be to pad the strings with preceding
spaces to make it appear as if they were right-aligned.
 
J

Jens Ansorg

Joel said:
I have data from a table that must be strings, not numbers, but I would like
to display it in a DropDownList WebControl right aligned. I tried using the
DataTextFormatString but with no luck. Any ideas?

its one of the many shortcomings of internet explorer

try this little sample in IE and then in Mozilla/Firefox and then go and
complain to Balmer/Gates ;)


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>DD text align test</title>
</head>

<body>

<select style="text-align:right;">
<option style="text-align:right;">asdds</option>
<option style="text-align:right;">ds asdfd as </option>
<option style="text-align:right;">tt tet</option>
</select>

</body>
</html>
 

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

Members online

Forum statistics

Threads
473,768
Messages
2,569,575
Members
45,054
Latest member
LucyCarper

Latest Threads

Top