用devexpress把gridview的一列设置成combobox属性后,如何把其中一行改成dateedit属性

首先在In—place Edior Repository添加DateEdit属性

        /// <summary>
        /// 重写控件时间
        /// customRowcelledit事件,指定rowhandle设置其repositoryitem为repositoryitemdateedit
        /// </summary>
private void myGridView_CustomRowCellEdit(object sender, DevExpress.XtraGrid.Views.Grid.CustomRowCellEditEventArgs  e)
        {

          //获取选择列的列名
            if (e.Column.FieldName == "值")
            {

              //e.RowHandle获取要选的行的序号

             //e.rowhandle=0,表示选择第一行
                string strFiledName = this.myGridView.GetRowCellValue(e.RowHandle, "字段").ToString();
                if (this.m_pFeatureCurrent != null && strFiledName!=null)
                {
                    int intFiledIndex = this.m_pFeatureCurrent.Fields.FindFieldByAliasName(strFiledName);
                    IField pField = this.m_pFeatureCurrent.Fields.get_Field(intFiledIndex);
                    if (pField.Type == esriFieldType.esriFieldTypeDate)
                    {

                      //重写控件
                        e.RepositoryItem = this.repositoryItemDateEdit1;
                    }
                }
            }
        }

然后就是需要实现gridView的单元格自定义编辑事件,如下所示。

       this.gridView1.CustomRowCellEdit += new DevExpress.XtraGrid.Views.Grid.CustomRowCellEditEventHandler(this.gridView1_CustomRowCellEdit);
或者直接绑定该事件


  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值