Reputation: 1449
I am using Devexpress 11.2
In a XtraGridView
I want to show Summary SUM
on a column with percent data
on the column i have repository spinEdit with mask "p2"
so if I have the display value 50% the value is 0.5
if I have on grid values
0.5 - 50%
0.3 - 30%
0.2 - 20%
the Summary SUM
will be 1 but i want to show 100%
can you help me please
thanks
Upvotes: 1
Views: 1064
Reputation: 35661
Set the DisplayFormat
property of the summary to capital "P".
See this for reference.
Upvotes: 3
Reputation: 22577
Add a custom unbound column.
http://documentation.devexpress.com/#WindowsForms/CustomDocument1477
Then on CustomUnboundColumnData,
void gridView1_CustomUnboundColumnData(object sender,
DevExpress.XtraGrid.Views.Base.CustomColumnDataEventArgs e) {
if (e.Column.FieldName == "Percent" && e.IsGetData) {
GridView view = (GridView)sender;
DataRow row = view.GetDataRow(e.RowHandle); //If datasource = datatable
//Use GetRow if custom business object and cast it.
e.Value = Value*100 + "%"; //I am sure there is a better way.
}
}
You can hide/remove the 'p2' column if you want.
Upvotes: 1