繁体   English   中英

c#dataGridView cellLeave事件未触发

[英]c# dataGridView cellLeave event not firing

我有一个DataGridView,并希望在我在该特定列(逐行)中输入值时用行的总和来更新标签。 它基本上是发票生成gridView。 在网格视图中输入物料价格时,我需要不断更新总量标签。 我正在尝试使用cellLeave事件,因为我希望在离开单元格并进入下一行时立即更新金额。 但是该事件没有触发。真的需要这方面的帮助! 我正在使用此代码:

private void dataGridView1_CellLeave(object sender, DataGridViewCellEventArgs e)
{
    if (e.ColumnIndex == 2)
    {
        Double result = 0;
        foreach (DataGridViewRow row in this.dataGridView1.Rows)
        {
            result += Convert.ToDouble(row.Cells[2].Value);
        }

        this.label3.Text = result.ToString();
    }
}

该事件应在客户端捕获。 尝试AJAXify控件,然后管理逻辑。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM