数据源,网格视图和下拉列表

数据源,网格视图和下拉列表

问题描述:

你好,

我有一个使用DataSource连接到DB的网格视图.
数据源具有一个查询,该查询从数据库中选择具有特定ID的项目.

另外,我有一个DropDown-List,我想更新dataSource的查询,因此,当用户从DropDown-List中选择某个索引时,它将在Grid View中显示相关数据.
请帮忙!

Hello,

I have a Grid View that connected to DB with DataSource.
The DataSource have a query that selects items from the DB that have a specific ID.

also, I have a DropDown-List and I want to update the query of the dataSource so when the user selects some index from the DropDown-List it will show the relevant data in the Grid View .

Please Help!

Thanks.

使用BindingSource.Filter过滤您的dataGridView.

更改DropDownList_SelectedIndexChanged中的过滤器.
Use BindingSource.Filter to filter your dataGridView.

change the filter in DropDownList_SelectedIndexChanged.