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

Grouping by column in RadGrid

1 Answer 321 Views
Sharepoint Integration
This is a migrated thread and some comments may be shown as answers.
LH
Top achievements
Rank 1
LH asked on 12 Jul 2009, 02:17 PM
Hi,
I have a SPDataSource which connected to SPList with title and choice columns (choice column name - "Choice").
I'm trying to group the grid MainTableView by the column 'Choice'.
I tried to do that with the GridGroupByExpression (With the column Ctor), and I get an error: "Field Choice not found in the source table. Please check expression syntax".
here's a code snippet:
"
ridBoundColumn colToGroup = (GridBoundColumn)this.myGrid.MasterTableView.Columns.FindByDataField("Choice");
GridGroupByExpression expr = new GridGroupByExpression(colToGroup);
this.myGrid.MasterTableView.GroupByExpressions.Add(expr);
this.myGrid.MasterTableView.DataBind();
  // Here the eror thrown.
"

Furthermore, I tried to build the group expression without the Ctor and I got the same error.

I would like some direction in the issue...

Thank You,
Neta

1 Answer, 1 is accepted

Sort by
0
Sebastian
Telerik team
answered on 14 Jul 2009, 11:22 AM
Hello LH,

The proper method to build group by expressions for RadGrid for ASP.NET AJAX is demonstrated in these online resources:

http://demos.telerik.com/aspnet-ajax/grid/examples/groupby/expressions/defaultcs.aspx
http://www.telerik.com/help/aspnet-ajax/grdgroupbyprogrammaticdefinition.html

Note that you need to specify at least one select field and one group by field for the newly created expression in order to be evaluated properly.

Additionally, you can test whether the manually created SELECT ... GROUP BY query is executed successfully by the SPDataSource when using regular MS GridView instance.

Best regards,
Sebastian
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
Sharepoint Integration
Asked by
LH
Top achievements
Rank 1
Answers by
Sebastian
Telerik team
Share this question
or