Khaledalmolaa
Khaledalmolaa

Reputation: 85

DevExpress How to get sum of GridView column's C#

I try to get summary of gridView column's and pass it to textEdit, I try this code:

textedit1.text= Convert.ToInt32(gridView1.Columns[1].SummaryItem.SummaryValue).ToString();

but always I get 0 value Can any one help me?

Upvotes: 0

Views: 7027

Answers (2)

Khaledalmolaa
Khaledalmolaa

Reputation: 85

I solve it by set SummaryType to sum and it works as a charm.

gridview1.Columns["salary"].SummaryItem.SummaryType = DevExpress.Data.SummaryItemType.Sum;

Or from the designer, select gridControl, quick menu, Run Designer: Columns, Select the required column, from its properties select SummaryItem and change SummaryType to sum.

Upvotes: 0

Beldi Anouar
Beldi Anouar

Reputation: 2180

You must set the GridView.OptionsView.ShowFooter property to true, you will see this summary value within a grid footer.

 textedit1.text = gridView1.Columns["Salary"].SummaryItem.SummaryValue.ToString();

Upvotes: 2

Related Questions