我想显示类似文本框的组合框 [英] I want to display the Combobox like textbox

查看:95
本文介绍了我想显示类似文本框的组合框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的项目中,当我单击组合框时,它会像文本框一样显示,它将被下拉并显示组合框的所有列表.操作方法.请任何人帮助此问题


谢谢您

In my project the Combobox displays just like textbox when i Click it ,it will be dropped down and displays all the list of the combobox how to do it.Please anyone help this problem


Thanking you

推荐答案

使用此
<asp:DropDownList ID="d" runat="server" AutoPostBack="false" style="display:none"
       onblur="b(this)">
   <asp:ListItem>1</asp:ListItem>
   <asp:ListItem>2</asp:ListItem>
   </asp:DropDownList>
   <asp:TextBox ID="txt2" runat="server"
    onfocus="f(this);" />




剧本




Script

<script type="text/javascript">
function b(ctr)
{
document.getElementById(''<%=txt2.ClientID %>'').style.display=''block'';
document.getElementById(''<%=txt2.ClientID %>'').value=ctr.value;
ctr.style.display=''none'';
}
function f(ctr)
{
ctr.style.display=''none'';
document.getElementById(''<%=d.ClientID %>'').style.display=''block'';
}

</script>




最好使用ajax自动完成扩展器.
Hi,

It is better to use ajax autocomplete extender.


将组合框显示属性设置为1.
set the combo box display property to 1.


这篇关于我想显示类似文本框的组合框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆