当前位置:网站首页>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
边栏推荐
- 购买小间距LED显示屏的三个建议
- Buried point 111
- Lombok 同时使⽤@Data和@Builder 的坑,你中招没?
- 不要再说微服务可以解决一切问题了!
- Some understandings of heterogeneous graphs in DGL and the usage of heterogeneous graph convolution heterographconv
- 【广告系统】Parameter Server分布式训练
- C language current savings account management system
- Applet framework taro
- Function///
- 九、磁盘管理
猜你喜欢
Wechat nucleic acid detection appointment applet system graduation design completion (8) graduation design thesis template
关于vray 5.2的使用(自研笔记)
Codeforces Round #804 (Div. 2)
关于vray5.2怎么关闭日志窗口
赛克瑞浦动力电池首台产品正式下线
Honing · fusion | know that the official website of Chuangyu mobile terminal is newly launched, and start the journey of digital security!
磨砺·聚变|知道创宇移动端官网焕新上线,开启数字安全之旅!
Web3基金会「Grant计划」赋能开发者,盘点四大成功项目
基础篇——REST风格开发
A mining of edu certificate station
随机推荐
Repair animation 1K to 8K
Go-3-the first go program
【全网首发】(大表小技巧)有时候 2 小时的 SQL 操作,可能只要 1 分钟
跨页面通讯
【广告系统】Parameter Server分布式训练
Stop saying that microservices can solve all problems!
Talk about the understanding of fault tolerance mechanism and state consistency in Flink framework
[first release in the whole network] (tips for big tables) sometimes it takes only 1 minute for 2 hours of SQL operation
Go project practice - Gorm format time field
Common functions of go-2-vim IDE
regular expression
四部门:从即日起至10月底开展燃气安全“百日行动”
The first product of Sepp power battery was officially launched
使用bat命令一键启动常用浏览器
web安全
How to introduce devsecops into enterprises?
Question bank and answers of special operation certificate examination for main principals of hazardous chemical business units in 2022
Nuxt//
Huawei equipment configures channel switching services without interruption
磨砺·聚变|知道创宇移动端官网焕新上线,开启数字安全之旅!