![](/img/trans.png)
[英]ADGV C# DataGridView - programatically call CellLeave Event
[英]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.