Dear All,
I have a grid bound to a datasource that returns amongst others flying hours in a column called HrsFlown (landing time-take off time). In this column I have minutes flown.
So, needless to say, when one selects the SUM summary it shows the sum of all the minutes flown.
Is there a way I can format the end result of the summary field to show hours as minutes ? I am comfy with concatenating the minutes/60 + ":" + minutes %60 , but it seems that the summary column is read only?
REgds
Paul
Hello Paul,
There are different approaches to solve this task. Maybe you could use ExternalSummary to convert your minutes into Hours + minutes. For example:
private void ultraGrid1_SummaryValueChanged(object sender, Infragistics.Win.UltraWinGrid.SummaryValueChangedEventArgs e){ double number; if (e.SummaryValue.SummarySettings.SourceColumn.Key == "Duration" && Double.TryParse(e.SummaryValue.Value.ToString(), out number)) { TimeSpan span = System.TimeSpan.FromMinutes(Convert.ToDouble(e.SummaryValue.Value)); string hours = ((int)span.TotalHours).ToString(); string minutes = span.Minutes.ToString(); eArgs.SummaryValue.SetExternalSummaryValue(hours + " h " + minutes + " min"); }}
private void ultraGrid1_ExternalSummaryValueRequested(object sender, Infragistics.Win.UltraWinGrid.ExternalSummaryValueEventArgs e){ eArgs = e;}
Please take a look at the attached smaple and video file for more details and let me know if you have any questions
Regards
Video Part 1
Video Part 2
this is the sample