当前位置:网站首页>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 边栏推荐
- Implement the rising edge in C #, and simulate the PLC environment to verify the difference between if statement using the rising edge and not using the rising edge
- DGL中异构图的一些理解以及异构图卷积HeteroGraphConv的用法
- 【全网首发】(大表小技巧)有时候 2 小时的 SQL 操作,可能只要 1 分钟
- 字符串、、
- msfconsole命令大全,以及使用说明
- A mining of edu certificate station
- Repair animation 1K to 8K
- Paradigm in database: first paradigm, second paradigm, third paradigm
- deepfake教程
- Lombok makes ⽤ @data and @builder's pit at the same time. Are you hit?
猜你喜欢

32:第三章:开发通行证服务:15:浏览器存储介质,简介;(cookie,Session Storage,Local Storage)

Three suggestions for purchasing small spacing LED display

Stop saying that microservices can solve all problems!

About the use of Vray 5.2 (self research notes) (II)

基于OpenHarmony的智能金属探测器

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

go语言学习笔记-初识Go语言

Go language-1-development environment configuration

Implement the rising edge in C #, and simulate the PLC environment to verify the difference between if statement using the rising edge and not using the rising edge

2022 t elevator repair operation certificate examination questions and answers
随机推荐
磨砺·聚变|知道创宇移动端官网焕新上线,开启数字安全之旅!
上拉加载原理
Pull up loading principle
Wechat nucleic acid detection appointment applet system graduation design completion (6) opening defense ppt
基础篇——基础项目解析
Go-3-the first go program
Variables///
Three suggestions for purchasing small spacing LED display
Leetcode 185 All employees with the top three highest wages in the Department (July 4, 2022)
[TCP] TCP connection status JSON output on the server
DDR4硬件原理图设计详解
go语言学习笔记-初识Go语言
web安全
Broyage · fusion | savoir que le site officiel de chuangyu mobile end est en ligne et commencer le voyage de sécurité numérique!
Go language learning notes - first acquaintance with go language
BOM//
Bidirectional RNN and stacked bidirectional RNN
Use bat command to launch common browsers with one click
Taro进阶
2022 t elevator repair operation certificate examination questions and answers