Solved

fixed size for dropdown list

Posted on 2004-09-23
11
269 Views
Last Modified: 2011-09-20
How to fix/limit the size of drop down. for ex size should be 30 where as one of the value has 50 charecters but i want to show only 30. can we control this.
0
Comment
Question by:amirup
  • 3
  • 2
  • 2
  • +2
11 Comments
 
LVL 5

Accepted Solution

by:
darksinclair earned 25 total points
ID: 12132234
you could always do the following before you write your <OPTION> statement

<%
output = rs("description")
if len(rs("description") > 30 then
     output = Left(rs("description"), 30)
end if
%>

Then simply output "output" instead of rs("description") for the select box.

Cheers.
0
 
LVL 31

Assisted Solution

by:alorentz
alorentz earned 25 total points
ID: 12132256
No points wanted, but to add to darksinclair...you should not just cut off the word, people will not like that.  So put ... on the end:

<%
output = rs("description")
if len(rs("description") > 30 then
     output = Left(rs("description"), 30) & "..."
end if
%>
0
 
LVL 14

Expert Comment

by:dfu23
ID: 12133068
CSS

<select style="width:200px;">
    <option> ...
</select>

Set the width to the desired size ...
0
 
LVL 31

Expert Comment

by:alorentz
ID: 12133120
dfu23 - this is not related to dropdown width...it's about character in the dropdown.
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 5

Expert Comment

by:darksinclair
ID: 12133335
ah yes, thanks alorentz.  Good eye. ;)
0
 
LVL 2

Expert Comment

by:Darksbane
ID: 12133370
@alorentz - How can you be so sure? The above question is vague enough to where if  amirup didn't know what CSS could do for him he might think that the only option he had is to remove characters from the drop down to set it to a specific size. Certanly there is nothing wrong with dfu23 giving an alternate solution which might better suit a fixed width select box. dfu23's solution also has the added benifit of not caring about the width of the character in the select box, so a box filled with 30 i's will still be the same length as a box filled with 30 w's.
0
 
LVL 5

Expert Comment

by:darksinclair
ID: 12133562
I was kind of intrigued by how dfu23's solution would work so I decided to make a little test script,

a nice solution, Im not sure I like the fact that the text goes all the way to the end of the box and the other information is there just not shown,,, but still a fairly simple solution.  

Here is my test if anyone wants to see the who different styles.

Cheers,

<%
dim output
output = "123456789012345678901234567890wwwwwww"
%>
<% 'Option #1 %>
<select>
<option>
<%
if len(output) > 30 then
   Response.Write( Left(output,30) & "..." )
else
   Response.Write( output )
end if
%>
</option>
</select>

<% 'Option #2 %>
<br>
<select style="width:200px;">
    <option><%=output%></option>
</select>
0
 
LVL 2

Expert Comment

by:Darksbane
ID: 12134010
"a nice solution, Im not sure I like the fact that the text goes all the way to the end of the box and the other information is there just not shown"

Were you testing in IE? Both Netscape and FireFox will actually display all the text when you click the dropdown. IE unfortunately still cuts it off even when you click the dropdown.
0
 

Author Comment

by:amirup
ID: 12408695
wanna share points between alorentz, darksinclair
thanks to both ....


alorentz u r solution is "luxury" to the solution given by darksinclair .... but u forgot to decrease the size of charecters to 27 as u r adding 3 additional charecters "...".
Thanks to both of you.

BTW any idea how to share the points?
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
An ASP query I cannot work out... 2 46
Time/Date Query 11 38
XML Parsing Classic ASP 5 50
Problems using Provider=OraOLEDB.Oracle via VBScript/Classic ASP 5 46
I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:  The Exchange of information …
I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now