views:

207

answers:

2

Hi, I have an asp dropdownlist loaded with cities/countries. They are loaded directly in code

<asp:ListItem Value="MIA">Miami, Florida</asp:ListItem>

I would like to extend the control with Ajax in order to allow a user to start typing and show similar matching options from a dropdownlist below. Is this possible using this control and the hard coded values? Thanks!

+3  A: 

The behaviour you describe is usually achieved by extending the textbox control rather than dropdownlist.

Microsoft has a lot of useful tutorials on its asp.net website; try this one: http://www.asp.net/AJAX/AjaxControlToolkit/Samples/AutoComplete/AutoComplete.aspx for a start.

Paul Suart
A: 

If you want to write your own control, I have written a blog about some of the gotchas when adding values to a DropDownList via javascript http://blog.runxc.com/post/2009/04/27/Using-jQuery-to-add-values-to-a-DropDownList-and-overcoming-ASPNET.aspx

runxc1 Bret Ferrier