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

Group Column Name

1 Answer 127 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Walid
Top achievements
Rank 1
Walid asked on 18 Oct 2014, 01:44 AM
Hi,

I'm sure this is an easy issue but i'm struggling to find a solution on my own. Basically I want to get the name of the column that i made groupby it.


example:
.
1- I have data in my radgridview and i drag and drop on of the column to make group by it.

2- I have an event 
   
Private Sub ReportingGridView_GroupByChanged(sender As Object, e As GridViewCollectionChangedEventArgs) Handles ReportingGridView.GroupByChanged

End Sub


my question is : how I can return the name of the column that I made group by it??????????????



PLZ Help...

1 Answer, 1 is accepted

Sort by
0
Accepted
Dess | Tech Support Engineer, Principal
Telerik team
answered on 22 Oct 2014, 11:03 AM
Hello Walid,

Thank you for writing.

In the GroupByChanged event you have access to the new group items via the GridViewCollectionChangedEventArgs.NewItems collection. It contains the GroupDescriptors that are currently applied:
private void radGridView1_GroupByChanged(object sender, GridViewCollectionChangedEventArgs e)
{
    //you are grouping by  and the Action=Add
    if (e.Action== Telerik.WinControls.Data.NotifyCollectionChangedAction.Add)
    {
        GroupDescriptor gd = e.NewItems[e.NewItems.Count - 1] as GroupDescriptor;
        RadMessageBox.Show(gd.GroupNames.First().PropertyName);
    }
}

I hope this information helps. Should you have further questions, I would be glad to help.

Regards,
Desislava
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
GridView
Asked by
Walid
Top achievements
Rank 1
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or