且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

根据列表框选择的项目过滤DataGridView

更新时间:2022-12-02 20:17:59

您好


1.让列表框具有分配给后台项目的value属性



2.现在每当用户选择一个列表框项目时,都会使用逗号分隔格式动态构建一个字符串例如:(1,2)



3.现在将这些值传递给如果尚未填充gridview,则为DB的参数。断开逗号分隔值并将它们放在临时表中,并将gridview结果与此表连接,然后传递e值返回到前端gridview,以便它只显示这些记录。



希望这会有所帮助。如果您需要任何其他信息,请告诉我。

如果是,请标记为答案。
Hi
1. Let the listbox have the value property assigned to the items in the background

2. Now whenever the user selects a listbox item have a string dynamically built using the comma separated format Eg: (1,2)

3. Now pass these values as parameters to the DB in case the gridview is not yet populated. Break the comma separated values and place them in a temp table and join the gridview results with this table and then pass these values back to the front end gridview so that it shows only these records.

Hope this helps. Let me know if you need any other information.
Please mark as answer if it is.