用devexpress把gridview的一列设置成combobox属性后,如何把其中一行改成dateedit属性
2018-01-18 11:03
549 查看
首先在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);或者直接绑定该事件
相关文章推荐
- DevExpress 设置DateEdit显示年月
- DevExpress的DateEdit设置显示日期和时间
- DevExpress的DateEdit设置显示日期和时间
- 如何让DevExpress的DateEdit控件正确显示日期的周名
- (转)DevExpress GridView属性设置
- [DevExpress]DateEdit设置显示日期和时间
- [DevExpress]ComboBoxEdit不可输入设置
- DevExpress GridView属性设置 z
- 如何让DevExpress的DateEdit控件正确显示日期的周名
- WinForm------DateEdit属性设置
- DevExpress GridView属性设置[轉]
- devExpress之GridView属性设置总结(图文)
- Flex中如何通过设置selectedDate属性设定DateChooser控件中被选择日期的例子
- 在GridView中LinkButton的属性的应用(如何不用选中就删除这一行)
- 在GridView中LinkButton的属性的应用(如何不用选中就删除这一行)
- DevExpress的DateEdit设置显示日期和时间
- listview中有几列,如果设置成每次选择选择一行,而不是其中的一列
- 基于DevExpress开发的GridView如何实现一列显示不同的控件类型
- edit控件中如何设置字体的颜色,并把一行文字设置成不同大小。
- .NET - 第三方控件Devexpress - ASPxGridView 的属性设置(B/S)