Devpress Gridcontrol Total line Custom calculation formula

Source: Internet
Author: User

Sometimes totals are not simply a column of sums, maximums, averages, and so on. Many times it is calculated on the basis of total,

Direct on Dry Goods

Set the view. Columns[strcolumnname]. Summaryitem.summarytype = DevExpress.Data.SummaryItemType.Custom; set when setting the table header

Add Customsummarycalculate method

To calculate in a method

The following example is my own calculation of the consumption and unit income of the method itself to change according to their own circumstances

private void Bandedgridview1_customsummarycalculate (object sender, DevExpress.Data.CustomSummaryEventArgs e)

{

if (bandedgridview1.columns["F_licheng"]. Summaryitem.summaryvalue! = null && convert.todecimal (bandedgridview1.columns["F_licheng"]. Summaryitem.summaryvalue)! = 0)

{

Single consumption

bandedgridview1.columns["F_danhao"]. Summaryitem.setsummary (DevExpress.Data.SummaryItemType.Custom, Math.Round (Convert.todecimal ( bandedgridview1.columns["F_fuel"]. Summaryitem.summaryvalue)/Convert.todecimal (bandedgridview1.columns["F_licheng"]. Summaryitem.summaryvalue)) * 100, 2). ToString ());

Unit income

bandedgridview1.columns["F_danmoney"]. Summaryitem.setsummary (DevExpress.Data.SummaryItemType.Custom, Math.Round (Convert.todecimal ( bandedgridview1.columns["F_income"]. Summaryitem.summaryvalue)/Convert.todecimal (bandedgridview1.columns["F_licheng"]. Summaryitem.summaryvalue)) * 1000, 2). ToString ());

}

}



This article comes from the "pit of Idea essay" blog, make sure to keep this source http://smilesun.blog.51cto.com/3351150/1838037

Devpress Gridcontrol Total line Custom calculation formula

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.