Grouping by column in RadGrid

2 posts, 0 answers
  1. LH
    LH avatar
    4 posts
    Member since:
    Jun 2009

    Posted 12 Jul 2009 Link to this post

    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);
      // 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,
  2. Sebastian
    Sebastian avatar
    9934 posts

    Posted 14 Jul 2009 Link to this post

    Hello LH,

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

    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,
    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.
Back to Top