1.设置gridview里面的属性中ShowFooter="True",就是把gridview的页脚显示出来

   this.gvData.OptionsView.ShowFooter = true;

  

2.设置要汇总的列,例如汇总"ReceiveMoney"金额列

3.给gridView添加CustomSummaryCalculate事件

private DataTable _dtSummaryTable = null;

string sql="SELECT * FROM Pay_Payable";
string sqlSummary = string.Format(@"SELECT SUM(ReceiveMoney) AS TotalReceiveMoney FROM ({0}) TEMP ", strSql);
sqlList.Add(sqlSummary);

string result = _mTargetService.GetEmployeePagerJson(strSql, deptId, Pager.PageIndex, Pager.PageSize, _gridSortAdv.OrderType, _gridSortAdv.OrderField, out totalRecord);
if (result != "")
{
_dtSummaryTable = JSonHelper.Deserialize<DataTable>(result);
}

/// <summary>
/// 汇总金额
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void gvData_CustomSummaryCalculate(object sender, DevExpress.Data.CustomSummaryEventArgs e)
{
   string tagName = (e.Item as GridSummaryItem).Tag.ToString();
  if (e.SummaryProcess == CustomSummaryProcess.Finalize)
  {
     if (_dtSummaryTable!=null && _dtSummaryTable.Rows.Count > 0 && tagName == "TotalReceiveMoney") //TotalReceiveMoney标识,格式化小数位   _dtSummaryTable:从数据查询出来的汇总表
     {
        e.TotalValue = DataTypeConvert.ToDecimal(_dtSummaryTable.Rows[0][tagName]);
     }
     else
     {
      e.TotalValue = DataTypeConvert.ToInt16(_dtSummaryTable.Rows[0][tagName]);
      }
  }
}

效果图如下: