DataGridView无法保存行状态的问题
代码如下
private void dataGridView1_RowLeave(object sender, DataGridViewCellEventArgs e)
{
this.dataGridView1.EndEdit();
}
private void Save(int rowIndex)
{
DataTable table = this.dataGridView1.DataSource as DataTable;
if (table == null)
return;
//table.GetChanges();
DataRow row = table.Rows[rowIndex];
if (row.RowState == DataRowState.Unchanged)
return;
}
我修改了选中行中每个cell的值,然后光标离开该行,发现映射到数据源中行状态总是DataRowState.Unchanged
那位大侠帮忙解决下啊~
--------------------编程问答-------------------- private void dataGridView1_RowLeave(object sender, DataGridViewCellEventArgs e)
{
this.dataGridView1.EndEdit();
this.datagridview1.commit();//提交更改
}
--------------------编程问答-------------------- 同样 也是DataRowState.Unchanged 状态
补充:.NET技术 , C#