根据列表框中的值进行搜索 [英] Searching based on values from list boxes
本文介绍了根据列表框中的值进行搜索的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在创建一个asp.net网站来搜索和显示员工的详细信息。我必须根据emp id,department和Grade进行搜索。部门和等级是列表框。我可以从中选择多个值。如何从这些列表框中检索所选项目并开始搜索?请完全帮助我.. !!!!
i am creating an asp.net website to search and display the employee details. i have to search based on emp id, department and Grade. department and grade are list boxes. i can select multiple values from it. How can i retrieve the selected items from those list boxes and start searching? please help me out completely..!!!!
推荐答案
if (ListBox1.Items.Count > 0)
{
for (int i = 0; i < ListBox1.Items.Count; i++)
{
if (ListBox1.Items[i].Selected)
{
string selectedItem = ListBox1.Items[i].Text;
string selectedValue = ListBox1.Items[i].Value;
//insert into array or something else...
}
}
}
这篇关于根据列表框中的值进行搜索的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文