可写和可搜索的下拉列表 [英] Writeable and searchable dropdownlist

查看:65
本文介绍了可写和可搜索的下拉列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用程序中有一个下拉列表,当用户输入下拉列表时,我想在该下拉列表下方显示带有gridview的数据并选择数据。然后数据必须显示在下拉列表中



我尝试过:



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;

以上代码在page_load

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

推荐答案

引用:

当用户输入下拉列表



DropDownList不允许您在其中输入内容。一个组合框。




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

Quote:

我想用gridview显示数据在该下拉列表下方并选择数据。然后数据必须显示在下拉列表中

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





您要做的事情就像自动填充文本框。根据您的偏好,有很多方法可以实现它。以下是其中几个:



ASP.Net中的AJAX AutoCompleteExtender示例 [ ^ ]



使用ASP.Net中的Web服务从数据库填充jQuery AutoComplete TextBox [ ^ ]



如果你真的想要一个多列自动完成,那么你可能需要制作自己的自定义控件或使用提供你所拥有的功能的第三方控件。例如: OBOUT - ASP.NET ComboBox - 类似网格的多列 [ ^ ]



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[^]


试试这个...






Try this...




(function(){
(function () {


这篇关于可写和可搜索的下拉列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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