469,268 Members | 1,021 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,268 developers. It's quick & easy.

Add horizontal Scroll bar to a Server Control Listbox or DropDownL

Hi Everyone,

How come Server listbox control does not have a Horizontal Scroll Property?
If any one has an idea how we add a Horizontal scroll to a listbox or
dropdown list box it would be quite helpful.Thanks in advance

Regards
Vidds

Nov 23 '05 #1
3 2346
Vidds wrote:
Hi Everyone,

How come Server listbox control does not have a Horizontal Scroll Property?
If any one has an idea how we add a Horizontal scroll to a listbox or
dropdown list box it would be quite helpful.Thanks in advance

Regards
Vidds


It's more than likely because the HTML SELECT control does not have that
capability (which is what ListBox renders to).

If you really, really need it, one idea would be to create a custom
ListBox class whose HTML looks like this: sets the width of the SELECT
to that of your widest value's width (the max width of the scrollbar,
for example). Now wrap that SELECT inside of a DIV of the 'constrained'
size and let it scroll on overflow.

--
craig
Microsoft MVP - ASP/ASP.NET
Nov 23 '05 #2
Thanks for the reply Craig .But if you can elaborate more on the solution it
would be great.

Regards
Vidds

"Craig Deelsnyder" wrote:
Vidds wrote:
Hi Everyone,

How come Server listbox control does not have a Horizontal Scroll Property?
If any one has an idea how we add a Horizontal scroll to a listbox or
dropdown list box it would be quite helpful.Thanks in advance

Regards
Vidds


It's more than likely because the HTML SELECT control does not have that
capability (which is what ListBox renders to).

If you really, really need it, one idea would be to create a custom
ListBox class whose HTML looks like this: sets the width of the SELECT
to that of your widest value's width (the max width of the scrollbar,
for example). Now wrap that SELECT inside of a DIV of the 'constrained'
size and let it scroll on overflow.

--
craig
Microsoft MVP - ASP/ASP.NET

Nov 23 '05 #3
Vidds wrote:
Thanks for the reply Craig .But if you can elaborate more on the solution it
would be great.

Regards
Vidds


Here's a quick example starting down those lines, here's the type of
HTML you want spit out by a control:

<div style="width:200px; height:100px; overflow:auto;">
<SELECT size="4">
<OPTION
Value="1">blahblahblahblahblahblahblahblahblahblah blahblah</OPTION>
<OPTION Value="2">2</OPTION>
<OPTION Value="3">3</OPTION>
<OPTION Value="4">4</OPTION>
</SELECT>
</div>

so in essence I'd recommend creating a composite custom control for
this, which renders this HTML. They're pretty easy to make, Google on
the terms 'composite control asp.net'.

The toughest part will be matching up the div dimensions to that of the
select box, to make the scrollbars work/line up properly. That's why
it's kinda tricky.

--
craig
Microsoft MVP - ASP/ASP.NET
Nov 23 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Max | last post: by
2 posts views Thread by Lloyd Sheen | last post: by
2 posts views Thread by Tina | last post: by
4 posts views Thread by André Nobre | last post: by
7 posts views Thread by Pachydermitis | last post: by
1 post views Thread by Mae Lim | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.