本文介绍了Devexpress - 如何将GridControl的数据放在另一个GridControl的排序/过滤的数据上?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的表单上有两个GridControl。一个是相当大的数据集,包括一个名为Score的列。我想让我的另一个GridControl显示一个这样的子集(例如,基于Score的前3和底3)。



我如何最好地完成这项工作?如果它是相同的GridControl,我想我可以使用不同的视图,但由于它是完全分开的,我应该抓住一个视图的副本,过滤/排序数据并将其显示为一个新的数据集?或者有没有办法将我的第二个GridControl的数据链接到我的第一个?



编辑:我可以做 grid2。 datasource = grid1.datasource 并从那里走。表不会有任何动态更新,所以也许这是要走的路?

解决方案

我将使用以下方法:



1)创建一个新的DataView,根据您的方法进行过滤,并将第二个gridControl的DataSource设置为此DataView;



OR



2)将第二个GridControl的DataSource属性设置为相同的值,并过滤相应的GridView。


I have two GridControls on my form. One is a fairly large dataset, including a column named Score. I want my other GridControl to show a subset of this (e.g. Top 3 and Bottom 3 based on the values of Score).

How can I best accomplish this? If it were the same GridControl I imagine I could just use a different view, but since it's completely separate, should I just grab a copy of the view, filter/sort the data and display it as a new dataset? Or is there a way to link my second GridControl's data to my first's?

edit: I could do grid2.datasource = grid1.datasource and go from there. There won't be any dynamic updates to the table so maybe this is the way to go?

解决方案

I would use the following approach:

1) create a new DataView, filter it based on your approach and set the second gridControl's DataSource to this DataView;

OR

2) set the DataSource property of the second GridControl to the same value and filter the corresponding GridView.

这篇关于Devexpress - 如何将GridControl的数据放在另一个GridControl的排序/过滤的数据上?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-20 21:47