zoukankan      html  css  js  c++  java
  • Dev 统计GridControl界面上当前选中的一行的值

            private void gridView1_CellValueChanged(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e)
            {    
                if( e.Column.FieldName.IndexOf("QTY")>-1)
                {
                    int total= 0;
                    object val = gridView1.GetRowCellValue(e.RowHandle, gridView1.Columns["MONTH1QTY"]);
                    total += val == DBNull.Value ? 0 :Convert.ToInt32(val);
                    val = gridView1.GetRowCellValue(e.RowHandle, gridView1.Columns["MONTH2QTY"]);
                    total += val == DBNull.Value ? 0 :Convert.ToInt32(val);
                    val = gridView1.GetRowCellValue(e.RowHandle, gridView1.Columns["MONTH3QTY"]);
                    total += val == DBNull.Value ? 0 :Convert.ToInt32(val);
                    val = gridView1.GetRowCellValue(e.RowHandle, gridView1.Columns["MONTH4QTY"]);
                    total += val == DBNull.Value ? 0 :Convert.ToInt32(val);
                    val = gridView1.GetRowCellValue(e.RowHandle, gridView1.Columns["MONTH5QTY"]);
                    total += val == DBNull.Value ? 0 :Convert.ToInt32(val);
                    val = gridView1.GetRowCellValue(e.RowHandle, gridView1.Columns["MONTH6QTY"]);
                    total += val == DBNull.Value ? 0 :Convert.ToInt32(val);
                    val = gridView1.GetRowCellValue(e.RowHandle, gridView1.Columns["MONTH7QTY"]);
                    total += val == DBNull.Value ? 0 :Convert.ToInt32(val);
                    val = gridView1.GetRowCellValue(e.RowHandle, gridView1.Columns["MONTH8QTY"]);
                    total += val == DBNull.Value ? 0 :Convert.ToInt32(val);
                    val = gridView1.GetRowCellValue(e.RowHandle, gridView1.Columns["MONTH9QTY"]);
                    total += val == DBNull.Value ? 0 :Convert.ToInt32(val);
                    val = gridView1.GetRowCellValue(e.RowHandle, gridView1.Columns["MONTH10QTY"]);
                    total += val == DBNull.Value ? 0 :Convert.ToInt32(val);
                    val = gridView1.GetRowCellValue(e.RowHandle, gridView1.Columns["MONTH11QTY"]);
                    total += val == DBNull.Value ? 0 :Convert.ToInt32(val);
                    val = gridView1.GetRowCellValue(e.RowHandle, gridView1.Columns["MONTH12QTY"]);
                    total += val == DBNull.Value ? 0 :Convert.ToInt32(val);
    
                    gridView1.SetRowCellValue(e.RowHandle,gridView1.Columns["SUM"], total);
                }
            }
  • 相关阅读:
    premake Ubuntu下的安装
    android设置eclipse中的自动提示功能
    SharePoint 2013的100个新功能之搜索(二)
    poj 4014 Dice 贪心
    代码手写UI,xib和StoryBoard间的博弈,以及Interface Builder的一些小技巧
    Android 英文文档下载地址
    winform网络编程之TcpClient类,TcpListener类和UdpClient类
    Spring Data MongoDB 三:基本文档查询(Query、BasicQuery)(一)
    const对象默觉得文件的局部变量
    springmvc自己定义拦截器
  • 原文地址:https://www.cnblogs.com/ShaYeBlog/p/3290708.html
Copyright © 2011-2022 走看看