• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 13390
  • Last Modified:

Adjusting the height of a ListBox (<select>)

Hi!
I'm using the ListBox on my HTML-page.

<select size="4" name="DrawingsList" id="DrawingsList" style="height:100%;width:100%;" >
  <option value="vvv" >TTT</option>
....
</select>

The ListBox is putted into a DIV and should cover all the space inside the DIV. But the height of the ListBox is automatically rounded and made divisible by the font's height. So, the height is a bit incorrect.

In WinForms and Win32, I know, you can turn off the "Integral height" mode and get exactly sized ListBox.

How can I get exactly sized ListBox in HTML?

Thanks for a response!
0
Alexey Fedorov
Asked:
Alexey Fedorov
  • 3
1 Solution
 
dctuckCommented:
Try using the ASP.NET ListBox control instead of the HTML equivalent - this should give you exact control over the size
0
 
dctuckCommented:
My mistake - looks like in the designer you can set the size, but when you run it, it automatically resizes!
0
 
Alexey FedorovSoftware developerAuthor Commented:
Yes, I'm using
<asp:ListBox ID="DrawingsList" runat="server"  DataSourceID="SqlDrawings" DataTextField="AssemblyName" DataValueField="AssemblyId" AutoPostBack="True" CssClass="DrawingsListClass" Height="100%" Width="100%"></asp:ListBox>

I have tried to set the height by means of Width property of the asp:ListBox and by means of CSS. The result is the same: rounded "Integral height" is used.
0
 
dctuckCommented:
Take a look at this:

http://www.codeproject.com/aspnet/ScrollableListBoxASP20.asp

I've just tried it out by creating a Custom Web Control using their technique and it seems to work! (In C#)
0
 
Computer101Commented:
Forced accept.

Computer101
EE Admin
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now