使用两个下拉列表从数据库中筛选数据并在gridview中显示结果 [英] to filter data from database by using two dropdown list and display the result in gridview

查看:59
本文介绍了使用两个下拉列表从数据库中筛选数据并在gridview中显示结果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Web应用程序的同一页面上有两个下拉列表.第一个下拉列表包含数据库中的学生ID,第二个下拉列表包含
如果学生从两个下拉列表中进行选择,则显示学生程序,最后将结果显示到Gridview中,它现在可以工作,但是
我的问题是选择第一个下拉菜单后
我想在girdview中显示结果列表,然后如果有必要,学生选择第二个下拉列表进行过滤并再次显示ingridview.我该怎么办?
请帮助

感谢

Hi,I have two dropdownlist on the same page in my web application. first dropdownlist contains student id from the database and the second dropdown list
display the student program if student select from two drop downlist finally display the result in to the gridview it is working now but
my qustion is after select the first dropdown
list i want to display the result in to girdview then if it is necessary the student select second dropdown list that filter and display again ingridview . how can i do it?
please help

Thanks

推荐答案

列表,我想将结果显示到girdview中,然后如果有必要,学生选择第二个下拉列表进行过滤并再次显示ingridview
步骤:
1.为两个
放置下拉列表"AutoPostBack = true" 2.在下拉列表的SelectedIndexChange事件中:
一个.第一个下拉菜单-获取选定的值,进行查询并获取要与网格绑定的数据.显示它.
b.第二个下拉菜单-获取两个下拉菜单的选定值,进行查询并获取要与网格绑定的数据.另外,您也可以使用DataView从先前获取的数据中过滤数据.显示它.

而已!逐步进行尝试.
list i want to display the result in to girdview then if it is necessary the student select second dropdown list that filter and display again ingridview
Steps:
1. Put dropdownlist ''AutoPostBack=true'' for both
2. In SelectedIndexChange event of the dropdowns:
a. First dropdown - get the selected value, make the query and get the data to bind with grid. Display it.
b. Second dropdown - get the selected value of both the dropdowns, make the query and get the data to bind with grid. Alternatively, you can filter data from previous fetched data too using DataView. Display it.

Thats it! Move step-by-step and tryout.


这篇关于使用两个下拉列表从数据库中筛选数据并在gridview中显示结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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