当前位置:网站首页>C # to obtain the filtered or sorted data of the GridView table in devaexpress
C # to obtain the filtered or sorted data of the GridView table in devaexpress
2022-07-05 11:09:00 【Milk coffee 13】
One 、 Requirements describe
At present, our business needs to obtain the right DevExpress in GridView Data content after filtering or sorting the table .
Two 、 Demand analysis
Direct access to GirdView The data content of the table is the first bound content , It will not change after filtering or sorting with the table control ; We can directly traverse the contents of the table to fill in the new DataTable Back in .
3、 ... and 、 Implementation method
#region Get the filtered or sorted data of the table
/// <summary>
/// obtain GridView Filtered or sorted dataset
/// </summary>
/// <typeparam name="T"> Generic class object </typeparam>
/// <param name="gridView">gridView Components </param>
/// <returns></returns>
public static IEnumerable<T> GetFilterOrSortDatasOfGridView<T>(DevExpress.XtraGrid.Views.Grid.GridView gridView) where T : class
{
var list = new List<T>();
for (int i = 0; i < gridView.RowCount; i++)
{
if (gridView.IsGroupRow(i))
continue;
var entity = gridView.GetRow(i) as T;
if (entity == null)
continue;
list.Add(entity);
}
return list;
}
/// <summary>
/// obtain GridView Filtered or sorted dataset
/// </summary>
/// <param name="gridView">gridView Components </param>
/// <returns></returns>
public static DataTable GetFilterOrSortDatasOfGridView(DevExpress.XtraGrid.Views.Grid.GridView gridView)
{
DataTable _dt = gridView.GridControl.DataSource as DataTable;
if (_dt == null) return null;
DataTable dt = _dt.Clone();
for (int i = 0; i < gridView.RowCount; i++)
{
if (gridView.IsGroupRow(i))
continue;
var dr = gridView.GetDataRow(i);
if (dr == null)
continue;
dt.Rows.Add(dr.ItemArray);
}
return dt;
}
#endregion 边栏推荐
- 磨砺·聚变|知道创宇移动端官网焕新上线,开启数字安全之旅!
- Some understandings of heterogeneous graphs in DGL and the usage of heterogeneous graph convolution heterographconv
- About the use of Vray 5.2 (self research notes)
- Array
- R3live series learning (IV) r2live source code reading (2)
- Common functions of go-2-vim IDE
- 流程控制、
- 关于vray5.2怎么关闭日志窗口
- 第五届 Polkadot Hackathon 创业大赛全程回顾,获胜项目揭秘!
- 数据类型、
猜你喜欢

【DNS】“Can‘t resolve host“ as non-root user, but works fine as root
![[Oracle] use DataGrid to connect to Oracle Database](/img/4f/886378667889f730eaed39b97f0a39.png)
[Oracle] use DataGrid to connect to Oracle Database

基于OpenHarmony的智能金属探测器

2022 chemical automation control instrument examination questions and online simulation examination

九、磁盘管理

关于vray 5.2的使用(自研笔记)(二)

Talk about the understanding of fault tolerance mechanism and state consistency in Flink framework

Go language-1-development environment configuration

磨砺·聚变|知道创宇移动端官网焕新上线,开启数字安全之旅!

一次edu证书站的挖掘
随机推荐
About the use of Vray 5.2 (self research notes)
DDR4的特性与电气参数
Three suggestions for purchasing small spacing LED display
Codeforces Round #804 (Div. 2)
Web3 Foundation grant program empowers developers to review four successful projects
埋点111
基于昇腾AI丨爱笔智能推出银行网点数字化解决方案,实现从总部到网点的信息数字化全覆盖
How to introduce devsecops into enterprises?
When using gbase 8C database, an error is reported: 80000502, cluster:%s is busy. What's going on?
谈谈对Flink框架中容错机制及状态的一致性的理解
regular expression
Taro advanced
Question bank and answers of special operation certificate examination for main principals of hazardous chemical business units in 2022
小红书自研KV存储架构如何实现万亿量级存储与跨云多活
Deepfake tutorial
DGL中的消息传递相关内容的讲解
SQL Server monitoring statistics blocking script information
32: Chapter 3: development of pass service: 15: Browser storage media, introduction; (cookie,Session Storage,Local Storage)
Paradigm in database: first paradigm, second paradigm, third paradigm
脚手架开发基础