当前位置:网站首页>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
边栏推荐
- Wechat nucleic acid detection appointment applet system graduation design completion (8) graduation design thesis template
- vite//
- Crawler (9) - scrape framework (1) | scrape asynchronous web crawler framework
- 小红书自研KV存储架构如何实现万亿量级存储与跨云多活
- [advertising system] parameter server distributed training
- Go project practice - Gorm format time field
- 九、磁盘管理
- Basic testing process of CSDN Software Testing Introduction
- Web3 Foundation grant program empowers developers to review four successful projects
- Go-2-Vim IDE常用功能
猜你喜欢
Based on shengteng AI Yisa technology, it launched a full target structured solution for video images, reaching the industry-leading level
Stop saying that microservices can solve all problems!
[advertising system] parameter server distributed training
Intelligent metal detector based on openharmony
Operation of simulated examination platform of special operation certificate examination question bank for safety production management personnel of hazardous chemical production units in 2022
Explanation of message passing in DGL
About the use of Vray 5.2 (self research notes)
Three suggestions for purchasing small spacing LED display
Characteristics and electrical parameters of DDR4
一次edu证书站的挖掘
随机推荐
2022 mobile crane driver examination question bank and simulation examination
运算符、、
小红书自研KV存储架构如何实现万亿量级存储与跨云多活
Go-3-the first go program
BOM//
Go project practice - parameter binding, type conversion
How to close the log window in vray5.2
数据类型 ntext 和 varchar 在not equal to 运算符中不兼容 -九五小庞
Network security of secondary vocational group 2021 Jiangsu provincial competition 5 sets of topics environment + analysis of all necessary private messages I
A mining of edu certificate station
How to introduce devsecops into enterprises?
deepfake教程
字符串、、
脚手架开发基础
Advanced scaffold development
【广告系统】增量训练 & 特征准入/特征淘汰
DGL中异构图的一些理解以及异构图卷积HeteroGraphConv的用法
websocket
第五届 Polkadot Hackathon 创业大赛全程回顾,获胜项目揭秘!
修复动漫1K变8K