DevExpress中GridControl的属性设置

1.隐藏最上面的GroupPanel

gridView1.OptionsView.ShowGroupPanel=false;

2.得到当前选定记录某字段的值

sValue=Table.Rows[gridView1.FocusedRowHandle][FieldName].ToString();

3.数据只读

gridView1.OptionsBehavior.Editable=false;

4.不显示MasterDetailView

gridView1.OptionsDetail.EnableMasterViewMode=false;

5.修改最上面的GroupPanel内容

gridView1.GroupPanelText="柳生飘絮";

6.数据绑定:

FieldName --数据库的字段名称

7.读写拷贝权限设置

ColumnView.Editable
    This property returns a value of the ColumnViewOptionsBehavior.Editable option
    不可写
ColumnViewOptionsBehavior.Editable
    Gets or sets whether end users are allowed to invoke cell editors
    可读可写

OptionsColumn.AllowEdit
    Gets or sets whether end users are allowed to invoke editors for the column‘s cells.
    可读可写
    只有ColumnViewOptionsBehavior.Editable = True设置OptionsColumn.AllowEdit才有意义

OptionsColumn.ReadOnly
    Gets or sets whether end-users are prevented from editing the column‘s cell values. 
    可读可写

If the ReadOnly property is set to true, the cell values of columns cannot be modified by end-users. In this case cell editors can be invoked but end users can only select and copy an editor‘s content. This option is not in effect if the column‘s AllowEdit or the view‘s ColumnView.Editable option is disabled.

Cell values can still be modified in code using the ColumnView.SetRowCellValue method regardless of the ReadOnly property‘s setting.

只读不可拷贝:
    ColumnViewOptionsBehavior.Editable = False

只读可拷贝:
    ColumnViewOptionsBehavior.Editable = True
    OptionsColumn.AllowEdit = True
    OptionsColumn.ReadOnly = True

可编辑:
    ColumnViewOptionsBehavior.Editable = True
    OptionsColumn.AllowEdit = True
    OptionsColumn.ReadOnly = False

获取选中行的值

代码:

private void gridData_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e)
        {
             _id = GWEntLib.Utilities.Mix.ConvertUtils.ToInt32(gridData.GetRowCellValu(e.FocusedRowHandle, "Id"));
             _emrFileReadList = EMRTemplateFileReadList.GetEMRTemplateFileReadList(_id);
            gridVersonData.DataSource = _emrFileReadList;
         
        }
响应事件:FocusedRowChanged
获取字段值:gridData.GetRowCellValue(e.FocusedRowHandle, "Id")
注意:FocusedRowChanged是Gridview的事件而不是gridControl的事件
gridControl与Gridview的区别:前者是容器,后者为视图

本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/liushengpiaoxu/archive/2008/12/01/3420996.aspx

DevExpress中GridControl的属性设置

时间: 2024-10-23 23:10:48

DevExpress中GridControl的属性设置的相关文章

devexpress中gridcontrol头部添加垂直线(右边框)

winform开发,用devexpress中的gridcontrol控件,头部默认是3D样式,当客户希望像内容一样扁平化显示且需要添加垂直线(右边框)时恶梦开始了..经过一阵摸索发现可以这样解决: 1.设置GridControl的GridView控件的PaintStyleName属性为Web 2.为GridControl的GridView控件添加CustomDrawColumnHeader事件,参考代码如下: private void gridView1_CustomDrawColumnHead

DEV控件:gridControl常用属性设置(转)

DEV控件:gridControl常用属性设置    1.隐藏最上面的GroupPanel   gridView1.OptionsView.ShowGroupPanel=false;    2.得到当前选定记录某字段的值   sValue=Table.Rows[gridView1.FocusedRowHandle][FieldName].ToString();   3.数据只读   gridView1.OptionsBehavior.Editable=false;   4.不显示MasterDe

DEV控件:gridControl常用属性设置【转载】

DEV控件:gridControl常用属性设置  1.隐藏最上面的GroupPanel   gridView1.OptionsView.ShowGroupPanel=false;  2.得到当前选定记录某字段的值   sValue=Table.Rows[gridView1.FocusedRowHandle][FieldName].ToString(); 3.数据只读   gridView1.OptionsBehavior.Editable=false; 4.不显示MasterDetailView

devexpress中gridcontrol 一些样式改变

改变footer为扁平化效果 整个footer背景色CustomDrawFootere.Appearance.BackColor = Color.Transparent; e.Appearance.DrawBackground(e.Graphics, e.Cache, e.Bounds); e.Handled = true; 单个列footer背景CustomDrawFooterCelle.Appearance.BackColor = Color.Lavender; e.Appearance.D

请将项目文件中的“AutoGenerateBindingRedirects”属性设置为 true 警告!!!

原文:请将项目文件中的"AutoGenerateBindingRedirects"属性设置为 true 警告!!! 原文地址:https://www.cnblogs.com/lonelyxmas/p/9678523.html

DEV控件:gridControl常用属性设置(转载)

特别长,先撸下来再说 1.隐藏最上面的GroupPanel  gridView1.OptionsView.ShowGroupPanel=false; 2.得到当前选定记录某字段的值  sValue=Table.Rows[gridView1.FocusedRowHandle][FieldName].ToString(); 3.数据只读  gridView1.OptionsBehavior.Editable=false; 4.不显示MasterDetailView  gridView1.Option

DEV控件:gridControl常用属性设置

1.隐藏最上面的GroupPanel  gridView1.OptionsView.ShowGroupPanel=false; 2.得到当前选定记录某字段的值  sValue=Table.Rows[gridView1.FocusedRowHandle][FieldName].ToString(); 3.数据只读  gridView1.OptionsBehavior.Editable=false; 4.不显示MasterDetailView  gridView1.OptionsDetail.Ena

Devexpress Gridcontrol 常用属性设置-不定时更新

//整行选中 this.grd_pageno.FocusRectStyle = DevExpress.XtraGrid.Views.Grid.DrawFocusRectStyle.RowFocus;

SqlMapConfig.xml中的setting属性设置

<settings     cacheModelsEnabled="true"     lazyLoadingEnabled="false"     enhancementEnabled="true"     maxSessions="64"     maxTransactions="8"     maxRequests="128"     useStatementNamespac