CSS Buttons

Some time ago I was working on a web site where we wanted to have a good rollover button control for ASP.NET in our projects that would eliminate the need for client-side script. Google search turned up a post that I've since lost that discussed using CSS for rollover of a button image with all states of the button in one image.

Using CSS and custom ASP.NET controls, this little project gives you a highly useful fixed width label control and a button control with three states and automatic rollovers without having to write a single line of javascript and without having to manage multiple image files for one button.

The FixedWidth label uses a CSS button and a little GDI+ to measure the length of the label text and truncate the text if necessary to fit it within the specified width. It then adds an elipsis button (you control the button as well) to which a javascript alert with the full string is hooked.

Download the source code and use these controls as you will. In it you'll find the control project and a test/example project to show you how to use it. If you find it useful and/or make changes/improvements to it, I'd love to hear from you and see what you've done with it.

CssWebControls.zip (45.1 KB)