Hi Tine Devolder,
Thanks for using Syncfusion Products.
Your requirement can be achieved by using the Custom type Summary Rows in
GridGroupingControl. We have prepared simple sample to meet your requirements
and the same can downloaded from the below link.
Sample: Summary_Time.zip
Please try the above sample and if it does not meets your requirement, could
you please provide more information on this so that we can provide a better
solution quickly?.
Please let us know if you have any other
concerns.
Regards,
Hariharan J.V.
Hi Tine Devolder,
Thanks for your update.
We glad to let you know that we have achieved your requirement. We have
modified sample which was provided earlier and the same can be downloaded from
the below link.
Sample: Summary_Time.zip
In the above sample we have displayed total time(hours + minutes)
in a single summary row. Please refer the below code snippets.
[Default.aspx.cs]
public static ISummary
TimeSummary(SummaryDescriptor sd, Record record)
{
if (record == null)
t1 = Convert.ToDateTime("0:0:0");
object obj = sd.GetValue(record);
if (record != null)
{
t1 = t1.AddHours(Convert.ToInt32(Convert.ToDateTime(record.GetValue("Date")).Hour));
t1 = t1.AddMinutes(Convert.ToInt32(Convert.ToDateTime(record.GetValue("Date")).Minute));
str = t1.ToString("HH mm");
}
return (obj == null
|| obj is DBNull)
? Empty : new TotalSummary(str);
}
Please let us know if you have any other concerns.
Regards,
Hariharan J.V.
Hi Tine Devolder,
Thanks for your update.
Query 1#: “How about more
then one column not only "Date"”
Currently we are working on
this query and this query forwarded to our development team. We will update you
in two business days(May 16,2013)
Query 2#: “I have a problem with your sample, when I run the
code it must be 42h but it is 18h”
We have modified the above
given sample to meet your requirements. Please refer the below code snippets.
[Default.aspx.cs]
public static ISummary TimeSummary(SummaryDescriptor
sd, Record record)
{
if (record == null)
{
i = 0;
t1 = Convert.ToDateTime("0:0:0");
}
object obj = sd.GetValue(record);
if (record != null)
{
if ((t1.Hour + Convert.ToInt32(Convert.ToDateTime(record.GetValue("Date")).Hour)) >= 24)
{
i++;
}
t1 = t1.AddHours(Convert.ToInt32(Convert.ToDateTime(record.GetValue("Date")).Hour));
if (((t1.Minute + Convert.ToInt32(Convert.ToDateTime(record.GetValue("Date")).Minute)) >= 60) &&
t1.Hour == 23)
{
i++;
}
t1 = t1.AddMinutes(Convert.ToInt32(Convert.ToDateTime(record.GetValue("Date")).Minute));
str = t1.ToString("HH:mm");
if (i != 0)
{
hh = Convert.ToDateTime(str).Hour;
mm = Convert.ToDateTime(str).Minute;
hh = hh + i * 24;
str = hh.ToString() + ":" +
mm.ToString();
}
}
return (obj == null
|| obj is DBNull)
? Empty : new TotalSummary(str);
}
And the modified sample can
be downloaded from the below link.
Sample: Summary_modified.zip
Please let us know if you
have any other concerns.
Regards,
Hariharan J.V.
Can you put the hours and minutes together??