我使用XtraGrid加载数据,为什么不能编辑?
我用XtraGrid加载DataTable动态生成的数据。可以显示,但是不能编辑,点击单元格,不会出现编辑框。请大神帮忙。
表格的view关键属性如下:
OptionsBehavior.Editable = true
OptionsBehavior.ReadOnly = false
加载数据的关键代码如下:
RecordSetColumn[] columns = recordSet.GetColumns();
//动态构建表,添加列
foreach (RecordSetColumn column in columns)
{
DataColumn dataColumn = new DataColumn();
dataColumn.DataType = column.Type;
dataColumn.ColumnName = column.Name;
dataColumn.Caption = column.Label;
this.dataTable.Columns.Add(dataColumn);
DevExpress.XtraGrid.Columns.GridColumn viewCol = new DevExpress.XtraGrid.Columns.GridColumn();
viewCol.Caption = dataColumn.Caption;
viewCol.FieldName = dataColumn.ColumnName;
viewCol.Name = dataColumn.ColumnName;
viewCol.Visible = true;
viewCol.OptionsColumn.AllowEdit = true;
viewCol.OptionsColumn.ReadOnly = false;
RepositoryItemTextEdit checkEdit = new RepositoryItemTextEdit();
this.gridControl1.RepositoryItems.Add(checkEdit);
viewCol.ColumnEdit = checkEdit;
view.Columns.Add(viewCol);
}
for (RecordSetRow row = recordSet.Read(); row != null; row = recordSet.Read())
{
DataRow dataRow = this.dataTable.NewRow();
foreach (RecordSetColumn column in columns)
{
object value = row;
dataRow = value;
}
this.dataTable.Rows.Add(dataRow);
}
this.gridControl1.DataSource = this.dataTable;
線上博弈的玩家喜歡比較喜歡有根據的下注技巧
页:
[1]