Get Result sum from two devexpress gridview’s Sum column

devexpress

i am using devexpress gridview 9.2.

i have 2 gridview having 2 colum –> Item & Rate. the Rate total is displayed on the footer for each gridview.

summary type="sum" is enabled for each grid.

i want to display result in a label.

The result is obtained from
the Sum of two gridview's FOOTER Sum colum .

Is this possible?

Best Answer

after both your Grids Are bound to DataSource, call the below method. However, Label cannot be updated if grids update via callbacks. in that case you need to use AspxCallback Panel, place 2 grids & label in Callback Panel, and PerformCallback on the CallbackPanel when grids need to be updated:

private void UpdateSummaryLabel(){
    double rate1 = double.Parse(grid1.GetTotalSummaryValue(grid1.TotalSummary["Rate", DevExpress.Data.SummaryItemType.Sum]).ToString());
    double rate2 = double.Parse(grid2.GetTotalSummaryValue(grid2.TotalSummary["Rate", DevExpress.Data.SummaryItemType.Sum]).ToString());

    label.Text = String.Format("{0:n2}", rate1 + rate2);
}
Related Topic