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

Custom GroupDescriptor Header

3 Answers 297 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Jayesh Valla
Top achievements
Rank 1
Jayesh Valla asked on 11 Aug 2010, 09:49 AM

Is it possible to have a different DisplayContent that is detached from the member on the GroupDescriptor object for the RadGrid?

 

Scenario: EscalationID is a guid and is set as the member. However, to make the UI user friendly. I need to change the grouping "Header" to a custom text or a different member.

3 Answers, 1 is accepted

Sort by
0
Veselin Vasilev
Telerik team
answered on 11 Aug 2010, 10:16 AM
Hi Jayesh Valla,

The GroupDescriptor class has a property DisplayContent which you can set to any text you want.
To do so, subscribe to the Grouping event and define its handler as follows:

private void clubsGrid_Grouping(object sender, GridViewGroupingEventArgs e)
{
    if (e.Action == System.ComponentModel.CollectionChangeAction.Add)
    {
        e.GroupDescriptor.DisplayContent = string.Format("Grouped by {0}", e.GroupDescriptor.Member);
    }
}

Hope this helps.

Regards,
Veselin Vasilev
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
Jayesh Valla
Top achievements
Rank 1
answered on 11 Aug 2010, 02:00 PM
Hi Veselin,

Unfortunately this did not solve my problem. I have included a code snippet to hopefully clarify what I am trying to achieve.
The data on the grid needs to be grouped by EscalationID, however the heading for the Groupings (on the Grid - not the Grid Heading) needs to display the Description of the EscaltionID.

Thanks

 

private void RadGridViewEscalations_Grouping(object sender, GridViewGroupingEventArgs e)
{
   if (e.GroupDescriptor == null)
   {
      GroupDescriptor groupDescriptor = new GroupDescriptor();
      groupDescriptor.Member = "EscalationID";
      groupDescriptor.SortDirection = ListSortDirection.Ascending;
      groupDescriptor.DisplayContent = "Description";
      RadGridViewEscalations.GroupDescriptors.Add(groupDescriptor);
   }
}

0
Vlad
Telerik team
answered on 11 Aug 2010, 02:26 PM
Hi,

 You can define GroupHeaderTemplate for every column - you can check this demo for more info. 

Greetings,
Vlad
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
Jayesh Valla
Top achievements
Rank 1
Answers by
Veselin Vasilev
Telerik team
Jayesh Valla
Top achievements
Rank 1
Vlad
Telerik team
Share this question
or