如何实现下拉列表框可编辑
我需要一个下拉列表可编辑的功能,在下拉列表控件中,可以直接输入,也可以点击黑的下三角进行选择,该怎么实现?上网查了下,有很多人好像都要这个功能,不过没看到比较好的实现,请教前辈们!
[解决办法]
使用ajax中autocomplete
网上有相关的javascript实现的!!可以去看看!!
http://www.orsoon.com/Article/Article_785.html
[解决办法]
autocomplete
private void comboBox1_TextChanged(object sender, EventArgs e)
{
if (comboBox1.Text.Length == 0)
comboBox1.DropDownStyle = ComboBoxStyle.Simple;
else
comboBox1.DropDownStyle = ComboBoxStyle.DropDown;
}
http://topic.csdn.net/u/20091120/20/36a4c64b-24c1-4655-a502-78ab1417413c.html
[解决办法]
- HTML code
<html xmlns="http://www.w3.org/1999/xhtml" ><head runat="server"> <title>Untitled Page</title><script language="javascript" type="text/javascript">function DisplayText(){ document.getElementById("txtDisplay").value = document.getElementById("ddSelect").value; document.getElementById("txtDisplay").focus();}</script></head><body> <form id="form1" runat="server"> <div> <asp:TextBox style="width:120px;position:absolute" ID="txtDisplay" runat="server"></asp:TextBox> <asp:DropDownList ID="ddSelect" style="width:140px" runat="server"> <asp:ListItem Value="test1" >test1</asp:ListItem> <asp:ListItem Value="test2">test2</asp:ListItem> </asp:DropDownList> </form></body></html>