【问题标题】:Using DataGridView events to save data back on the database使用 DataGridView 事件将数据保存回数据库
【发布时间】:2014-05-30 12:56:40
【问题描述】:

我在表单中有一个DataGridView,我正在使用List<Object> 填充网格。

bindingSource.DataSource = List;       
_View.GridData = bindingSource; //GridData is a property in the UI which encapsulates grid's datasource property.

一旦网格完全填充,我想触发一个事件,然后将网格中的数据保存回数据库中。

OnSaveGridData (sender, e);

但对网格数据所做的个别更改(例如更改单元格中的值)不应触发此事件。

我该怎么做?

【问题讨论】:

  • 请不要我不能使用rowAdded,因为它每次添加一行时都会触发

标签: c# .net data-binding datagridview generic-list


【解决方案1】:

你可以使用

void dataGridView_DataSourceChanged(object sender, EventArgs e)
    {
        MessageBox.Show("datasourcechanged");
    }

【讨论】:

    猜你喜欢
    • 2016-07-17
    • 1970-01-01
    • 2013-08-03
    • 2012-07-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多