如何在我的asp.net中使用c#创建可写和可搜索的下拉列表# [英] how to create writable and searchable dropdown list in my asp.net usin c#

查看:93
本文介绍了如何在我的asp.net中使用c#创建可写和可搜索的下拉列表#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在我的asp.net中创建可写和可搜索的下拉列表使用c#给我示例代码请



提前感谢....

解决方案

我认为根据我的知识,这是不可写的ddl ....



但是我会解释一下可搜索的下拉列表...

第一种类型....



当你从工具箱中将ddl带到表格或网页时......只需选择然后转到属性页...他们可以在工具中找到组合框/下拉列表...然后只需将它放到你的位置......然后去属性他们你可以找到项目集合点击它在你的下拉列表中添加你想要看到的东西.....

喜欢

国家:美国,英国,印度这样的



第二种类型....



serachable ddl menas你想把所有的表内容系列放到ddl那么简单使用下面的代码:



con.Open();

SqlComma nd cmd = new SqlCommand(select * from StateTable,CountryID =+ CountryID,con);

SqlDataAdapter da = new SqlDataAdapter(cmd);

DataSet ds = new DataSet();

da.Fill(ds);

con.Close();

ddlState.DataSource = ds;

ddlState.DataTextField =StateName;

ddlState.DataValueField =StateID;

ddlState.DataBind();

ddlState.Items.Insert(0,new ListItem( - Select--,0));

if(ddlState.SelectedValue ==0)

{

ddlRegion.Items.Clear();

ddlRegion.Items.Insert(0,new ListItem( - Select - ,0 ));

}


使用ajax组合框,您将获得此功能可写和可搜索的下拉列表。下面的一些链接会帮助你很多





ASP.NET中的Ajax ComboBox






Ajax组合框


请使用AJAX控制器中提供的扩展控制器



请通过以下链接,它可能帮助完整;。



http://www.asp。 net / ajaxLibrary / AjaxControlToolkitSampleSite / DropDown / DropDown.aspx [ ^ ]

how to create writable and searchable dropdown list in my asp.net usin c# give me sample code please

thanks in advance....

解决方案

i think thier is no writable ddl up to my knowledge....

but i will explain about the searchable dropdownlist...
First type....

when u took ddl from toolbox to form or webpage..just simply select it and go to the properties page... their u can find "combobox/drop down list" in tools... then simply rag it on to ur place...then go to the propertis their u can find items collection click on it n add ur items their what to want to see in ur dropdownlist.....
like
country: usa,uk,india like that

Second type....

serachable ddl menas u want to drop all the table content series to the ddl then simply use the below code:

con.Open();
SqlCommand cmd = new SqlCommand("select * from StateTable where CountryID="+CountryID, con);
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
da.Fill(ds);
con.Close();
ddlState.DataSource = ds;
ddlState.DataTextField = "StateName";
ddlState.DataValueField = "StateID";
ddlState.DataBind();
ddlState.Items.Insert(0, new ListItem("--Select--", "0"));
if(ddlState.SelectedValue=="0")
{
ddlRegion.Items.Clear();
ddlRegion.Items.Insert(0, new ListItem("--Select--", "0"));
}


Use ajax combobox you will get this feature writable and searchable dropdownlist. Below some link's which will help you lot


Ajax ComboBox in ASP.NET



Ajax combobox


please use an extender controllers which are available in AJAX controller

please go through the below link it maybe help full;.

http://www.asp.net/ajaxLibrary/AjaxControlToolkitSampleSite/DropDown/DropDown.aspx[^]


这篇关于如何在我的asp.net中使用c#创建可写和可搜索的下拉列表#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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