Problem solve Get help with specific problems with your technologies, process and projects.

Implementing a ComboBox control in ASP.NET

The DropDownList control does not provide editability, i.e. does not act as a ComboBox. The only thing you can do with DropDownList is to pick up an item from a list, but you cannot type in your own text. Is this correct? If yes, could you please advise how to implement a kind of a ComboBox control in ASP.NET? Thank you.
Platform: Win2000
Implementing the ComboBox in ASP.NET would consist of: a composite custom control, containing a textbox for the editable region, an image for the "faked" dropdown, next to the textbox, and a <div> containing all items. With JavaScript, you'd have to react to the click on the image, and show/hide the div (i.e. set its "display:block" or "display:none"). You'd have to take care of positioning too. Alternatively, you could try having both a textbox and a dropdown list with absolute positioning, overlapping each other. You can make the textbox narrower than the dropdown so the arrow appears (the dropdown should have it's Z-order less than the textbox'). Then, through JavaScript, when the user clicks on an item in the dropdown, you set the textbox value accordingly.

Dig Deeper on ASP.NET and Ajax development

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.