1.遍历

for (int i = ; i < gridView1.RowCount; i++)
{
for (int j = ; j < gridView1.Columns.Count; j++)
{
object val = gridView1.GetRowCellValue(i, gridView1.Columns[j]);
}
}

2.为某行设置背景色

 private void gridView1_RowStyle(object sender, RowStyleEventArgs e)
{
GridView View = sender as GridView; if (e.RowHandle >= )
{
string category = View.GetRowCellDisplayText(e.RowHandle, View.Columns["允许打印"]); if (category == "是")
{
e.Appearance.BackColor = Color.Salmon; e.Appearance.BackColor2 = Color.SeaShell;
}
}
}

3.上一条和下一条

public void PlayBefore(){
//当前行
int selectedIndex=this.gridView1.FocusedRowHandle;
if(selectedIndex==){
XtraMessageBox.Show("已经是第一条","提示",MessageBoxButtons.OK,MessageBoxIcon.Information);
return;
}
//选择上一行
this.gridView1.FocusedRowHandel=this.gridView.FocusedRowHandle-;
this.gridView1.ClearSellection();
this.gridView1.SelectRow(this.gridView1.FocusedRowHandle);
}
public void PlayNext(){
//当前行
int selectedIndex=this.gridView1.FocusedRowHandle;
if(selectedIndex==this.gridView1.RowCount-){
XtraMessageBox.Show("已经是最后一条","提示",MessageBoxButtons.OK,MessageBoxIcon.Information);
return;
}
//选择下一行
this.gridView1.FocusedRowHandel=this.gridView.FocusedRowHandle+;
this.gridView1.ClearSellection();
this.gridView1.SelectRow(this.gridView1.FocusedRowHandle);
}

4.获取当前行

int focusRowIndex=this.gridView1.GetFocusedDataSourceRowIndex();
DataModel model=this.gridView1.GetRow(focusRowIndex) as DataModel;

5.自定义排序

private void gridView1_CustomColumnSort(object sender, DevExpress.XtraGrid.Views.Base.CustomColumnSortEventArgs e)
{
if (e.Column != null && e.Column.FieldName == "FieldName")
{
int value1 = Convert.ToInt32(e.Value1.ToString());
int value2 = Convert.ToInt32(e.Value1.ToString()); e.Result = System.Collections.Comparer.Default.Compare(value1, value2);
e.Handled = true;
}
}

6.复制表格

 private string CopyGrid()
{
MemoryStream memoryStream = new MemoryStream();
gridControl1.ExportToText(memoryStream);
memoryStream.Position = ;
byte[] read = new byte[memoryStream.Length];
memoryStream.Read(read, , read.Length);
string content = Encoding.Default.GetString(read);
return content;
}

7.ColumnPositionChanged

DEV--GerdView控件的更多相关文章

  1. Dev系列控件的AJAX (转)

    介绍Dev系列控件在前台也就是客户端的一些常用方法介绍以及前后台异步通信的方法. 一.Dev Data Edit控件通用属性以及方法: 属性 1.GetEnabled():返回控件是否为可操作状态 2 ...

  2. dev的控件放在没有runat="server"的标签中,回调出现的问题

    dev的控件放在没有runat="server"的标签中,第一次回调是会刷新页面, 有runat="server"时不会刷新页面

  3. ASP.NET Dev ASPxGridView控件使用 ASP.NET水晶报表打印

    1.ASPxGridView控件使用 2.ASP.NET水晶报表客户端打印 3.javascript打印 4.ASPxGridView根据Textbox查询 5. ASPxGridView 列宽 1. ...

  4. Dev系列控件的AJAX使用Demo

    一.Dev Data Edit控件通用属性以及方法: 属性 1.GetEnabled():返回控件是否为可操作状态 2.GetText():返回控件的Text的值 3.SetEnabled():设置控 ...

  5. dev layoutControl 控件使用

    对于排版控件,用微软的方法都是先拉 label再拉一个 Textbox  ,  虽然微软的控件了有类似于 EXCEL的单元格全并功能,但用起来使终不方便, 今天研究了一下 DEV 的这个控件,比微软的 ...

  6. DEV 第三方控件报表分类汇总

    最近这段时间难得空闲,于是打算做个报表功能,主要实现数据的分类汇总,以便不时之需.首先看看效果: 主要是根据工程类型这个字段进行分类,每个分类下对应的项目金额进行求和,当然,你也可以根据实际需求,进行 ...

  7. 2016.1.19 DEV Express控件GirdControl使用

    103.GridControl中添加Button RunDesigner,添加一列,设置对应字段FiledName,ColumnEdit选择ButtonEdit,此时默认风格像下拉框,需调整属性: 在 ...

  8. Winform 中DataGridView、dev Gridview控件添加行标题

    有很多种方法. 1.可以在DataGridView控件中的RowStateChanged事件改变行标题单元格的值(Row.HeaderCell.Value) /// <summary> / ...

  9. Dev常用控件

    GridControl TreeView DEV GridControl小结.. https://blog.csdn.net/happy09li/article/details/7186829 Dev ...

  10. DEV提示控件ToolTipControl

    1.设置边框的颜色和显示箭头图标:在构造函数里面设置 public frmLogin()        {            InitializeComponent(); //设置边框颜色     ...

随机推荐

  1. poj2553 强连通

    题意:定义了一个图的底(bottom),是指在一个图中能够被所有点到达的点,问途中有哪些点是图的底. 首先是同一个强连通分量中的点都能够互相到达,强连通分量中一个点能到达其他点,也必然代表该强连通分量 ...

  2. HTML5里autofocus属性

    转载:http://www.webhek.com/html5-autofocus/ HTML5给我们带来了一大堆神奇的东西.以前需要用JavaScript和Flash完成的任务,例如表单校验,INPU ...

  3. 【P1351】构建双塔

    奇怪的DP 原题: 2001年9月11日,一场突发的灾难将纽约世界贸易中心大厦夷为平地,Mr. F曾亲眼目睹了这次灾难.为了纪念“9?11”事件,Mr. F决定自己用水晶来搭建一座双塔. Mr. F有 ...

  4. tomcat 源码解析

    how_tomcat_works https://www.uzh.ch/cmsssl/dam/jcr:00000000-29c9-42ee-0000-000074fab75a/how_tomcat_w ...

  5. C#中IP地址转换为数值的方法

    任何语言都通用的方法转换 IP 地址 a.b.c.d ==> a***+b**+c*+d ===> *(c+*(b+*a)) +d 示例: ***+**+*+ ===> *( +*( ...

  6. InnoDB Plugin文件格式(概述)

    本文将介绍InnoDB Plugin数据表格式的基本概念. 1. 配置参数innodb_file_format 这是一个很容易混淆的概念.目前,在InnoDB Plugin(1.0.6)配置文件中in ...

  7. Comparison of B-Tree and Hash Indexes

    Understanding the B-tree and hash data structures can help predict how different queries perform on ...

  8. python数据库连接池

    python数据库连接池 import psycopg2 import psycopg2.pool dbpool=psycopg2.pool.PersistentConnectionPool(1,1, ...

  9. 网页上下载文件提示框(vb.net)

    Public Sub downLoadFile(ByVal fPath As String) Dim fileInfo As System.IO.FileInfo = New System.IO.Fi ...

  10. sublime安装sftp和ctags插件

    1. 安装Package Control插件 , 安装是通过Sublime Text 2控制台.这是通过按Ctrl + `快捷访问.一旦打开,粘贴以下命令到控制台. 输入以下python代码 subl ...