Click here to Skip to main content
15,915,093 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have one dropdownlist in my application and when user type in dropdownlist, I want to show the data with gridview beneath that dropdownlist and select data. and then data must be shown in dropdownlist

What I have tried:

cmd = new SqlCommand("select * from Customer", con);
adp.SelectCommand = cmd;
adp.Fill(dt);
DropDownList1.DataTextField = "CustomerName";
DropDownList1.DataValueField = "CustomerName";
DropDownList1.DataSource = dt;
DropDownList1.DataBind();
DropDownList1.Items.Insert(0, new ListItem("- - - Select - - -", ""));
DropDownList1.SelectedIndex = 0;
above codes are in page_load
Posted
Updated 18-Aug-16 3:37am
v4
Comments

Quote:
when user type in dropdownlist

A DropDownList doesn't allow you to input something in it. A combobox does.

Quote:
I want to show the data with gridview beneath that dropdownlist and select data. and then data must be shown in dropdownlist


What you are tying to do is something like an autocomplete textbox. There are many ways to implement it based on your preference. Here are couple of them:

AJAX AutoCompleteExtender Example in ASP.Net[^]

Populate jQuery AutoComplete TextBox from Database using Web Service in ASP.Net[^]

If you really want a multi-column autocomplete, then you may need to craft your own custom control or use a thrid party control that provides the feature that you have. For example: OBOUT - ASP.NET ComboBox - Grid-Like Multi-Columns[^]
 
Share this answer
 
Try this...



$(function () {
$('[id*=DropDownList1]').multiselect({
enableFiltering: true
});
});
 
Share this answer
 
Comments
Vincent Maverick Durano 18-Aug-16 9:42am    
that seems to turn a select emelent to a listbox.
Smita_Jadhav 18-Aug-16 9:49am    
yeah...we can chose multiple option by using this.

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