A ComboBox is a control that displays a TextBox combined with a ListBox - which enables the user to either select an item from the list or type their own. They have many uses - as I'm sure most of you are aware.
I've always had a hard time trying to understand why Microsoft haven't provided a decent implementation of a ComboBox for ASP.NET applications. They have tried - and its included in the AJAX Control Toolkit - but its pretty darn useless if you ask me.
Don't get me wrong, there are plenty of permutations of ComboBox out there and as the adage goes "great programmers don't write what can be stolen", but the best ones aren't free and I just couldn't justify paying for something that should be. So I got to work and made my own:
Pretty nice isn't it?
Features of the control:
- Nice and smooth sliding action
- Its lightweight and simple
- Renders in all browsers
Overall it took me around 2 simple hours to create, so why after 9 years since the ASP.NET framework has been released can Microsoft not provide a decent clone of the Windows ComboBox?
By all means my version is no way finished - it was created it to make a point. However by providing the source on here I've hopefully filled a gap in the ASP.NET control selection. I know that by storing it on here I should hopefully never lose it, and also allow others to use as they wish.
A couple of things you may want to implement into this control:
- Allow the height of the listbox to change dynamically depending on its contents
- Add a load more methods (perhaps to bring it in line with the AJAX Control Toolkit)
- Ajaxify it - what isn't these days?
I'm providing it as a Visual Studio 2008 solution so you can fire it up straight away, however it's trivial to open in any version. You can grab it here. I must say I'm quite proud of it.
All in all its a simple control - but it works perfectly for what I need. Please download the source and modify as you wish, however I'd be grateful if you cited me as the source. Perhaps even Microsoft will pick up on it (I can wish).