我希望代码能够点击按钮点击表中的搜索数据,我通过asp.net中的下拉列表选择搜索名称 [英] I want code for on button click search data from tables and I am selecting search name through dropdownlist in asp.net

查看:101
本文介绍了我希望代码能够点击按钮点击表中的搜索数据,我通过asp.net中的下拉列表选择搜索名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在此链接

推荐答案

这里我们回答成员在编程时遇到的具体问题。



我们无法处理整个源代码。你需要自己做。

如果你在编码时遇到任何困难,请随时回到这里并提出另一个问题来描述这个场景。



会员很乐意为您提供帮助。



Happy Coding。 :)
Here we answer specific questions which members face during programming.

We can't work on the whole source code. You need to do that yourself.
If you face any difficulty while coding, feel free to come back here and ask another question with specific issue describing the scenario.

Members will be happy to help you then.

Happy Coding. :)


首先从DB中绑定下拉列表,将值成员设置为Id,将Display成员设置为显示名称



例如:从db获取值并放入数据表

dropdwnlist .datasource = dt; //例如:dt =(id = 1,2,3 name ='a','b', 'c')

dropdownlist.databind();



dropdownlist.displaymember =name;

dropdownlist.valuemember =id;



dropdwnlist_selectedindexchanged()

{

dbclass.getelements(dropdownlist。的SelectedValue);

}







//在dbclass中

getelements(字符串值)

{

创建连接

代码从DB访问数据

查询=从表中选择项目,其中selectid ='+ value +';

............



}
First you bind your drop down from DB,set value member as Id,and Display member as your displayname

eg: take value from db and put into a datatable
dropdwnlist .datasource= dt ;//for eg: dt =(id=1,2,3 name='a','b','c')
dropdownlist.databind();

dropdownlist.displaymember="name";
dropdownlist.valuemember="id";

dropdwnlist_selectedindexchanged()
{
dbclass.getelements(dropdownlist.selectedvalue);
}



//in dbclass
getelements(string value)
{
create connection
code for access data from DB
Query ="select item from table where selectid='"+ value+"'";
............

}


这篇关于我希望代码能够点击按钮点击表中的搜索数据,我通过asp.net中的下拉列表选择搜索名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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