We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Sum of Time (Hours & Minutes)

Thread ID:

Created:

Updated:

Platform:

Replies:

108612 May 2,2013 03:55 AM Mar 28,2018 03:02 AM ASP.NET Web Forms (Classic) 13
loading
Tags: GridGroupingControl
Tine Devolder
Asked On May 2, 2013 03:55 AM

Can you get the sum of time (hours & minutes) in a summary row? 
Time is a column in my grid.

Hariharan J V [Syncfusion]
Replied On May 6, 2013 01:42 AM

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.

 

 

 


Tine Devolder
Replied On May 6, 2013 05:51 AM

What about timespan?

Tine Devolder
Replied On May 6, 2013 05:57 AM

It doesn't get the sum of time 
  • min = 0
  • hour = 0

Tine Devolder
Replied On May 6, 2013 06:04 AM

It's okay. I have make a error

Tine Devolder
Replied On May 6, 2013 08:05 AM

Can you put the hours and minutes together?? 

Hariharan J V [Syncfusion]
Replied On May 7, 2013 06:38 AM

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.


Tine Devolder
Replied On May 8, 2013 02:08 AM

Thanks

Tine Devolder
Replied On May 8, 2013 04:30 AM

How about more then one column not only "Date"

t1 = t1.AddHours(Convert.ToInt32(Convert.ToDateTime(record.GetValue("Date")).Hour));
                t1 = t1.AddMinutes(Convert.ToInt32(Convert.ToDateTime(record.GetValue("Date")).Minute));

Tine Devolder
Replied On May 8, 2013 05:09 AM

I have a problem with your sample,
when I run the code it must be 42h but it is 18h


Summary_Time_Tine_555c50d8.rar

Tine Devolder
Replied On May 13, 2013 08:27 AM

?

Hariharan J V [Syncfusion]
Replied On May 14, 2013 08:53 AM

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.

 


ALDO
Replied On March 27, 2018 02:42 PM

Can you put the hours and minutes together?? 

How many controls in  Essential Studio 


Isuriya Rajan [Syncfusion]
Replied On March 28, 2018 03:02 AM

Hi Tine Devolder, 

If you are looking for the ASP.NET MVC controls, please refer the below online sample and documentation link for our latest Essential ASP.NET MVC controls which are created over our next generation JavaScript controls. 



Please get back to us if you need further assiatance. 

Regards, 
Isuriya R 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;