Improved Listbox server control

L

lisa

Well... I finally did it. I built a control, inherited from the
regular ASP.NET ListBox control, that adds two features that are
extremely useful:

1) It scrolls horizontally.
You just set the height and width, and it works almost
exactly like a Windows Form ListBox. It's not graphically
100% perfect, because <select> tags can never have a
height that's a fraction of an item. It always goes up
or down to an even item. But it's definitely workable.

The only thing I'm not sure about is whether or not it'll
work on all browsers. I know it works on IE6, though, and
that's good enough for me.

2) It supports attributes on the items.
There's a bug in the standard ListBox where you can add
attributes to the items, but they aren't rendered. And
if you force them to render by overriding the Render or
RenderContents method, you still lose them when you
postback. This new control renders them and retains them
when you postback.

In design-time, it looks and acts just like a regular ListBox.

I got good advice from a lot of different sites, but the person most
helpful (who actually supplied most of the code for the control) was
Alessandro Zifiglio, and I'm indebted to him.

I'm thinking of posting the control and the sourcecode somewhere. I
just haven't decided where. Suggestions are welcome.

Lisa
 

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

No members online now.

Forum statistics

Threads
474,143
Messages
2,570,822
Members
47,368
Latest member
michaelsmithh

Latest Threads

Top