Adding a horizontal scroll bar to a ListBox using Razor

curiouswebster
curiouswebster used Ask the Experts™
on
Iam populating a listbox in Razor properly. But the item is much longer than the visible are and I need a horizontal scroll bar.

How do I add one?

Thanks.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Commented:
You could set the scroll to a Div and set the scroll bar on there, see this link:

http://stackoverflow.com/questions/2743050/how-to-make-the-horizontal-scroll-bar-in-listview
curiouswebsterSoftware Engineer

Author

Commented:
I am using Razor which has no <asp> tags. So the link would not work.

Here's what my ListBox loooks like:

@Html.ListBox("OutputList", Model.OutputList, new { style = "height:85px;width:500px" })

It's already sized. Maybe there's an additional property?
Try this,

<div style="overflow:auto">
	@Html.ListBox("OutputList", Model.OutputList, new { style = "height:85px;" })
</div>

Open in new window

curiouswebsterSoftware Engineer

Author

Commented:
Thanks! Sorry for the delay...

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial