当前位置:网站首页>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
边栏推荐
- Bracket matching problem (STL)
- Msfconsole command encyclopedia and instructions
- Repair animation 1K to 8K
- 关于vray 5.2的使用(自研笔记)
- 一次edu证书站的挖掘
- [first release in the whole network] (tips for big tables) sometimes it takes only 1 minute for 2 hours of SQL operation
- 关于vray 5.2的使用(自研笔记)
- 【广告系统】增量训练 & 特征准入/特征淘汰
- [JS learning notes 54] BFC mode
- Share Net lightweight ORM
猜你喜欢
Detailed explanation of MATLAB cov function
关于 “原型” 的那些事你真的理解了吗?【上篇】
9、 Disk management
Wechat nucleic acid detection appointment applet system graduation design completion (7) Interim inspection report
关于vray 5.2的使用(自研笔记)
购买小间距LED显示屏的三个建议
Codeforces Round #804 (Div. 2)
不要再说微服务可以解决一切问题了!
Go语言-1-开发环境配置
Go-3-第一个Go程序
随机推荐
Stop saying that microservices can solve all problems!
Share Net lightweight ORM
Variables///
2022 Pengcheng cup Web
LSTM applied to MNIST dataset classification (compared with CNN)
2022 t elevator repair operation certificate examination questions and answers
Lazy loading scheme of pictures
uniapp
正则表达式
regular expression
Honing · fusion | know that the official website of Chuangyu mobile terminal is newly launched, and start the journey of digital security!
Intelligent metal detector based on openharmony
Network security of secondary vocational group 2021 Jiangsu provincial competition 5 sets of topics environment + analysis of all necessary private messages I
DOM//
Sqlserver regularly backup database and regularly kill database deadlock solution
Leetcode 185 All employees with the top three highest wages in the Department (July 4, 2022)
Go-2-Vim IDE常用功能
Four departments: from now on to the end of October, carry out the "100 day action" on gas safety
MFC pet store information management system
Some understandings of heterogeneous graphs in DGL and the usage of heterogeneous graph convolution heterographconv