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

Grouping the same Member several times.

2 Answers 14 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Martin Egger
Top achievements
Rank 2
Martin Egger asked on 22 Apr 2010, 11:32 AM
Hi everyone

Quick question:

Is there a way to group the same Member several times? Take a look at the following code:

                         
                        <telerik:GridViewDataColumn Header="Jahr" DataMemberBinding="{Binding datum}" DataFormatString="{}{0:yyyy}" /> 
                        <telerik:GridViewDataColumn Header="Monat" DataMemberBinding="{Binding datum}" DataFormatString="{}{0:MMM}" /> 
                        <telerik:GridViewDataColumn Header="Tag" DataMemberBinding="{Binding datum}" DataFormatString="{}{0:dd}" /> 
 
         

I would like to group by Year (Jahr) and Month (Monat). Because the Member is always "datum" (date), I only can group one at a time.
Is there  a way to achieve this within or outside the RadGridView?


2 Answers, 1 is accepted

Sort by
0
Tsvyatko
Telerik team
answered on 22 Apr 2010, 11:55 AM
Hello Martin Egger,

The cleanest way to create such functionality is to define get-only property wrappers in our data model, that return the pert of the date needed. E.g.
public int Year
{
   get {return this.Date;}
}

That way there will be group descriptor for each data property.

All the best,
Tsvyatko
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
Martin Egger
Top achievements
Rank 2
answered on 29 Apr 2010, 01:25 PM
Hi

Thx alot. Had some problems fingering out where to implement the code. After some research it worked by creating a partial class of that particular entity.

Works fine!
 public partial class Eingang 
    { 
        public DateTime Jahr 
        { 
            get { return _datum; } 
        } 
 
        public DateTime Monat 
        { 
            get { return _datum; } 
        } 
 
    } 
Tags
GridView
Asked by
Martin Egger
Top achievements
Rank 2
Answers by
Tsvyatko
Telerik team
Martin Egger
Top achievements
Rank 2
Share this question
or