This is a migrated thread and some comments may be shown as answers.

DateTime Group

7 Answers 148 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Carlos Teevin
Top achievements
Rank 1
Carlos Teevin asked on 21 Jun 2010, 10:13 PM
I have a column with a datetime, how i can group it by day, and not by the entire date and time?????

7 Answers, 1 is accepted

Sort by
0
Alexander
Telerik team
answered on 23 Jun 2010, 07:29 PM
Hello Carlos Teevin,

There are some known issues concerning custom grouping in the current version of RadGridVew.

You can use a work around this by adding a hidden (isVisivle = false) column and populate it with integer values corresponding to the days in the GridViewDateTimeColumn. Then you can use the GroupByExpressions CollectionChanged event to replace the grouping expression of your DateTime column with an expression for your hidden column:
this.radGridView1.MasterGridViewTemplate.GroupByExpressions.CollectionChanged += new NotifyCollectionChangedEventHandler(GroupByExpressions_CollectionChanged);
 
private void GroupByExpressions_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
{
    int index = this.radGridView1.MasterGridViewTemplate.GroupByExpressions.IndexOf("Date");
    if (index >= 0)
    {
        this.radGridView1.MasterGridViewTemplate.GroupByExpressions.RemoveAt(index);
        this.radGridView1.MasterGridViewTemplate.GroupByExpressions.Add("[HiddenColumn] Group By [HiddenColumn]");
    }
}

We are working on removing the custom grouping issues for the next versions of RadGridView.

Greetings,
Alexander
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Carlos Teevin
Top achievements
Rank 1
answered on 23 Jun 2010, 10:15 PM
Actually i had to do it like this, because the previous code doesnt compile, im using beta q2
radGridView1.MasterTemplate.GroupDescriptors.CollectionChanged += new Telerik.WinControls.Data.NotifyCollectionChangedEventHandler(GroupByExpressions_CollectionChanged);  
 

        void GroupByExpressions_CollectionChanged(object sender, Telerik.WinControls.Data.NotifyCollectionChangedEventArgs e)  
        {  
            int index = radGridView1.MasterTemplate.GroupDescriptors.IndexOf(  
              radGridView1.MasterTemplate.GroupDescriptors.FirstOrDefault(x => x.GroupNames.IndexOf("TransactionDate") > -1));  
              
            if (index >= 0)  
            {  
                radGridView1.MasterTemplate.GroupDescriptors.RemoveAt(index);  
                radGridView1.MasterTemplate.GroupDescriptors.Insert(index,  
                    new Telerik.WinControls.Data.GroupDescriptor("Date ASC"));  
            }  
        } 

0
Carlos Teevin
Top achievements
Rank 1
answered on 23 Jun 2010, 10:33 PM
Is there anyway to apply formatstring to the group header text?
im getting 25/10/2001 12:00 AM and i want to apply the formatstring {0:d}
0
Julian Benkov
Telerik team
answered on 29 Jun 2010, 01:06 PM
Hello Carlos Teevin,

You can customize the group header text by using the GroupSummaryEvaluate event. For additional information, please refer to this blog article.

RadGridView Q2 Beta has some known issues regarding GroupSummaryEvaluate event which is not fired in some cases. They will be addressed in the official Q2 2010 release due in the first half July.

Greetings,
Julian Benkov
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Stefan
Telerik team
answered on 16 Jul 2010, 09:38 AM
Hi Carlos Teevin,

I am writing to inform you that the issue that you have submitted in this ticket has been solved in Q2 2010(http://www.telerik.com/products/whats-new-winforms.aspx). Feel free to take a look at our Release Notes which will guide you through all the improvements and changes that were made in this release.

You can download the new version from Downloads (http://www.telerik.com/account/downloads.aspx), section of your account.

As always we will appreciate your feedback on the new release, since this is very important part of our company policies.

If you need any assistance, do not hesitate to contact us.
 
Sincerely yours,
Stefan
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Versile
Top achievements
Rank 1
answered on 11 Aug 2010, 11:05 PM
The blog article you posted is outdated and a good portion of the code in that blog article will not even work any longer. especially the Aggregates section.
0
Stefan
Telerik team
answered on 17 Aug 2010, 10:13 AM
Hi Versile,

Thank you for writing.

Please refer to this help article. In case it does not contain the information you need, do not hesitate to write us back. We will be glad to assist you.

Greetings,
Stefan
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
GridView
Asked by
Carlos Teevin
Top achievements
Rank 1
Answers by
Alexander
Telerik team
Carlos Teevin
Top achievements
Rank 1
Julian Benkov
Telerik team
Stefan
Telerik team
Versile
Top achievements
Rank 1
Share this question
or