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)

What About Me

I am a .NET developer and architect with more years in the software industry than I care to admit, the last seven of which have been spent architecting and implementing web and rich client applications for the enterprise. For the last four years I have worked nearly exclusively in C#.

I jumped into C# in 2001 when I read Borland's lawsuit against Microsoft over the fact that Bill had lured many key people away from Borland (all's fair in love and war, no condemnation here) to work on what was the precursor to .NET and C#. That's where I first learned of Anders Hejlsberg. I was already a Delphi enthusiast and reading about Anders journey north got me very interested in what he had produced.

At the time, I was considering moving away from Delphi and into the J2EE world. I consulted with a friend who was already a very successful consultant in that space. He read the winds blowing in from the northwest and suggested I would be better off, in terms of job opportunities in the future, if I went with C# and .NET. I haven't looked back since. I do look over the fence at J2EE from time to time to see what's happening but I don't think you could get me to switch from Diet Coke to coffee.