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);
                }
            }
  • 相关阅读:
    前端基础开发之HTML
    内置函数(二)
    html
    内置函数(一)
    二进制安装mysql
    .net Parallel并行使用
    MVC 枚举绑定 DropDownList
    MVC扩展Url.Action方法解决复杂对象参数问题
    Index.cshtml”处的视图必须派生自 WebViewPage 或 WebViewPage<TModel>。
    设置网站URL启动
  • 原文地址:https://www.cnblogs.com/ShaYeBlog/p/3290708.html
Copyright © 2011-2022 走看看