列视图的总和

时间:2018-04-27 14:05:41

标签: c# gridview sum devextreme gridcontrol

我想获取两列中数字的总和并写入textedit。代码不会给出错误,但它不会执行操作。问题出在哪里?

void Numbersum()
    {
        int sumday = 0;
        int sumnight = 0;
        for (int i = 0; i < gridView1.RowCount; i++)
        {

            sumday += Convert.ToInt32(gridView1.GetRowCellValue(i, "Day").ToString());
            sumnight += Convert.ToInt32(gridView1.GetRowCellValue(i, "Night").ToString());
        }
        textEdit26.Text = sumday.ToString();
        textEdit27.Text = sumnight.ToString();
    }   

enter image description here

enter image description here

1 个答案:

答案 0 :(得分:0)

您的问题标签 devextreme 但似乎您实际上在寻找 xtraGrid dxDataGrid cellValue您可以使用https://ideone.com/QTOs7l方法。

grid.cellValue(rowIndex, dataField);