Devexpress GridView 常用操作总结
一:Clone返回新的 DataTable
Clone返回新的 DataTable,与当前的 DataTable 具有相同的架构;Copy:返回新的 DataTable,它具有与该 DataTable 相同的结构(表架构和约束)和数据
DataRow[] _dr = DT.Select("CLSSBH='"+ Filter_Str +"'");
DataTable dt = DT.Clone() ;
DataRow dr ;
for( int j = 0 ;j < _dr.Length ;j ++ )
{
dr = dt.NewRow() ;
dr = _dr[j] ;
dt.ImportRow( dr ) ;
}
一般使用DataTable.Rows.Add(row.ItemArray);
二:选中某一行
GridView.FocusedRowHandle =i;
GridView.SelectRow(i);
三:遍历GridView
for (int i = 0; i < gridView1.RowCount; i++)
{
for (int j = 0; j < gridView1.Columns.Count; j++)
{
object val = gridView1.GetRowCellValue(i, gridView1.Columns[j]);
}
}
四:单元格双击响应
需要先将gridview1.OptionsBehavior.Editable设为false,然后响应gridControl1_DoubleClick事件。
private void gridControl1_DoubleClick(object sender, EventArgs e)
{
MouseEventArgs arg = e as MouseEventArgs;
if (arg == null)
return;
GridHitInfo hitInfo = gridView1.CalcHitInfo(new Point(arg.X, arg.Y));//获取坐标点
if (hitInfo.RowHandle >= 0)
{
DataRow row = gridView1.GetDataRow(hitInfo.RowHandle);
_list.Clear();
_list.Add(row[0].ToString());
gisResoureMonControl1.SetSelectResource(_list);
}
}
五:GridView隐藏行
需要响应CustomRowFilter事件,用来设置过滤条件;
需要根据原始数据源结合起来,才能方便地隐藏或者显示行;
/// <summary>
/// 根据条件查询并在表格中显示结果
/// </summary>
/// <param name="strCondition"></param>
private void QueryTable(string strCondition)
{
DataTable table = gridControl1.DataSource as DataTable;
if (table == null)
return;
_indexlist.Clear();
for (int i = 0; i < table.Rows.Count; i++)
{
for (int j = 0; j < table.Columns.Count; j++)
{
if(table.Rows[i][j].ToString().Contains(strCondition))
{
_indexlist.Add(i);
gridView1.RefreshData();
break;
}
}
}
if (_indexlist.Count==0)
HideGridView();
}
/// <summary>
/// gridView的行隐藏或显示的过滤条件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void gridView1_CustomRowFilter(object sender, RowFilterEventArgs e)
{
if (_indexlist.Count == 0)
return;
if(_indexlist.Contains(-2))
e.Visible = true; //全显示
else if (_indexlist.Contains(-3))
e.Visible = false; //全隐藏
else if(_indexlist.Contains(e.ListSourceRow))
e.Visible = true;
else
e.Visible = false;
e.Handled = true;
}
Devexpress GridView 常用操作总结的更多相关文章
- DevExpress GridView 整理(转)
DevExpress GridView 那些事儿 1:去除 GridView 头上的 "Drag a column header here to group by that column&q ...
- DevExpress GridView 那些事儿
1:去除 GridView 头上的 "Drag a column header here to group by that column" --> 点击 Run Desig ...
- DevExpress GridView 整理
1:去除 GridView 头上的 "Drag a column header here to group by that column" --> 点击 Run Desig ...
- 【三】用Markdown写blog的常用操作
本系列有五篇:分别是 [一]Ubuntu14.04+Jekyll+Github Pages搭建静态博客:主要是安装方面 [二]jekyll 的使用 :主要是jekyll的配置 [三]Markdown+ ...
- php模拟数据库常用操作效果
test.php <?php header("Content-type:text/html;charset='utf8'"); error_reporting(E_ALL); ...
- Mac OS X常用操作入门指南
前两天入手一个Macbook air,在装软件过程中摸索了一些基本操作,现就常用操作进行总结, 1关于触控板: 按下(不区分左右) =鼠标左键 control+按下 ...
- mysql常用操作语句
mysql常用操作语句 1.mysql -u root -p 2.mysql -h localhost -u root -p database_name 2.列出数据库: 1.show datab ...
- nodejs配置及cmd常用操作
一.cmd常用操作 1.返回根目录cd\ 2.返回上层目录cd .. 3.查找当前目录下的所有文件dir 4.查找下层目录cd window 二.nodejs配置 Node.js安装包及源码下载地址为 ...
- Oracle常用操作——创建表空间、临时表空间、创建表分区、创建索引、锁表处理
摘要:Oracle数据库的库表常用操作:创建与添加表空间.临时表空间.创建表分区.创建索引.锁表处理 1.表空间 ■ 详细查看表空间使用状况,包括总大小,使用空间,使用率,剩余空间 --详细查看表空 ...
随机推荐
- YAML 在Python中的应用
编程免不了要写配置文件,怎么写配置也是一门学问. YAML 是专门用来写配置文件的语言,非常简洁和强大,远比 JSON 格式方便. YAML在python语言中有PyYAML安装包,下载地址:http ...
- ieda常用快捷键
Ctrl+Shift + Enter,语句完成“!”,否定完成,输入表达式时按 “!”键Ctrl+E,最近的文件Ctrl+Shift+E,最近更改的文件Shift+Click,可以关闭文件Ctrl+[ ...
- 把e.printStackTrace的堆栈信息打印在log.error()中
不要这样写: log.error(e);这样只是简单的记录下错误的类型,不能精确出错误出错在哪行 要写成:log.error(e.toString(),e);
- 批量删除Redis中的key
bin/redis-cli -h 192.168.46.151 -p 6379 keys "rulelist*" | xargs bin/redis-cli -h 192.168 ...
- linux的chown命令
chown将指定文件的拥有者改为指定的用户或组,用户可以是用户名或者用户ID:组可以是组名或者组ID:文件是以空格分开的要改变权限的文件列表,支持通配符.系统管理员经常使用chown命令,在将文件拷贝 ...
- Microsoft Sync Framework 2.1 可再发行程序包 Microsoft Sync Framework 1.0 SP1 - 中文(简体)
Sync Framework 2.1 引入了新功能,这些功能支持您计算机上的 SQL Server 或 SQL Server Compact 数据库与 SQL Azure 数据库进行同步.此发行版还引 ...
- [Other] An Overview of Arrays and Memory
One integer takes 32bit in memory, 1 byte = 8bits, therefore one integer takes 4 bytes. Now let's as ...
- [Tools] Deploy a Monorepo to Now V2
Now by Zeit has recently been updated and now supports multi-language monorepos. In this lesson we'l ...
- 质量平台建设之Mock平台
转载:http://blog.csdn.net/spark2008/article/details/51372913 基于目前系统越来越多,在项目开发过程中,减少各模块之间的开发依赖,另保证各个系统模 ...
- [Fri, 3 Jul 2015 ~ Tue, 7 Jul 2015] Deep Learning in arxiv
Convolutional Color Constancy can this be used for training cnn to narrow the gap between different ...