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

GroupByExpressions is empty at the first time

2 Answers 29 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Doraemon
Top achievements
Rank 1
Doraemon asked on 19 Sep 2013, 08:02 AM
Hi all,

I use a header context menu to group or ungroup my records in a grid
http://www.telerik.com/help/aspnet-ajax/grid-header-context-menu.html

and I use GroupByExpressions to order by my records.

When I click GroupBy menu at the first time, in event MyRadGrid_NeedDataSource, I get GroupByExpressions by doing the following codes:
MyRadGrid.MasterTableView.GroupByExpressions. But at this time, GroupByExpresssions is empty. I expected that this time there is a record
of GroupByExpresssions.

When I click GroupBy menu again, At this time, GroupByExpressions has one record.???

So my questions are
- Can I get GroupByExpressions when I click on GroupBy menu at the first time ? and How ?
- If Not, Is there any way to workaround this issue ?

Thanks.

2 Answers, 1 is accepted

Sort by
0
APESTANA
Top achievements
Rank 2
answered on 20 Sep 2013, 12:58 PM
Hi,
I also have  this problem.
Looking for a solution...
Thanks.

0
Eyup
Telerik team
answered on 24 Sep 2013, 09:04 AM
Hi,

Generally, it is not a good practice to implement any logic in the NeedDataSource event except datasource acquiring. You can use the following event to handle the grouping operation of the grid:
protected void RadGrid1_GroupsChanging(object sender, GridGroupsChangingEventArgs e)
{
    string expression = e.Expression.Expression;
}

Hope this helps. Please give it a try and let me know if it works for you.

Regards,
Eyup
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
Tags
Grid
Asked by
Doraemon
Top achievements
Rank 1
Answers by
APESTANA
Top achievements
Rank 2
Eyup
Telerik team
Share this question
or