Click here to Skip to main content
15,894,907 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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
Posted

use this
<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>
 
Share this answer
 
v2
Hi,

It is better to use ajax autocomplete extender.
 
Share this answer
 
set the combo box display property to 1.
 
Share this answer
 
Comments
Suresh Suthar 22-Dec-11 1:30am    
OP's questions is about Asp.Net DropDownList, not WinForm ComboBox.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900