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

Remove groupbyexpression programatically

2 Answers 140 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Gino Suarez
Top achievements
Rank 1
Gino Suarez asked on 30 Nov 2009, 06:26 PM
Hi, I create a group like outlook grouping using groupbyexpression programatically when i press a button based on particular circunstances, but also i need to remove this new group created programatically. Actualy i have other 2 groupbyexpression defined in design time, i just need to remove new groups created in runtime hope you can help me.

Using tk_Grid.MasterTableView.GroupByExpressions.Clear(); i clear all the groups but i just to remove one at time

tk_Grid.MasterTableView.GroupByExpressions.Add(new GridGroupByExpression("CodigoPlanCuenta Group By CodigoPlanCuenta")); 


Regards Gino

2 Answers, 1 is accepted

Sort by
0
Accepted
Johny
Top achievements
Rank 1
answered on 02 Dec 2009, 02:53 PM
Hi Gino,

You can try something like this:

RadGrid1.MasterTableView.GroupByExpressions.RemoveAt(2); 
RadGrid1.Rebind(); 

I hope this helps,
Johny


0
Emre Kocyigit
Top achievements
Rank 1
answered on 03 May 2010, 09:16 PM
In my case the Clear(); method throws an ArgumentOutOfRangeException.
.Remove() and RemoveAt() are the same.
What can be the reason?

I use toolbar to programmatically create and remove grouping.

Full code is below.

Thanks in advance


    GridGroupByExpression expr1 = new GridGroupByExpression(RadGrid1.Columns[1]);
RadGrid1.MasterTableView.GroupByExpressions.Add(expr1);
//this is fine.
But 
RadGrid1.MasterTableView.GroupByExpressions.Clear() .RemoveAt() throws the error.
Tags
Grid
Asked by
Gino Suarez
Top achievements
Rank 1
Answers by
Johny
Top achievements
Rank 1
Emre Kocyigit
Top achievements
Rank 1
Share this question
or