
先把值赋值在右边,以便更改,更改的同时也设置值在左边。通过行结束编辑事件实现自动保存。
代码如下:

int _FocusedRowHandle = -1;
string _FocusedColumn = "";
private void gridView1_ShowingEditor(object sender, CancelEventArgs e)
{
//获取当前视图
DevExpress.XtraGrid.Views.Grid.GridView view = sender as DevExpress.XtraGrid.Views.Grid.GridView;
//获取当前行数据
var curRow = ((DataRowView)_v织布日报BindingSource.Current).Row;
this.txtValue.EditValueChanged -= new System.EventHandler(this.txtValue_EditValueChanged);
txtValue.EditValue = curRow[view.FocusedColumn.FieldName] + "";
this.txtVal

该代码示例展示了如何在DevExpress的GridView控件中实现行编辑结束时自动保存更改。通过监听`ShowingEditor`事件获取当前编辑的值,并在`EditValueChanged`事件中更新对应的行单元格。这确保了用户在操作过程中数据的实时保存。
最低0.47元/天 解锁文章
8586





