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

grid not grouping data - says grouping field not found in the source table

1 Answer 144 Views
Grid
This is a migrated thread and some comments may be shown as answers.
andieje
Top achievements
Rank 1
andieje asked on 07 Nov 2012, 07:51 PM
Hi

I am using quite an old version of radgrid (q3 2009). The grid is not grouping my data. I have tried to group the data programmatically and declaratively and i get the same error. I am trying to group the data by a field called Reg which definitely exists in the underlying data as it displays fine in the grid if i remove any attempt to group the data

Here is the code
Dim expression As GridGroupByExpression = New GridGroupByExpression
     Dim gridGroupByField As GridGroupByField = New GridGroupByField
     'SelectFields values (appear in header)
     gridGroupByField = New GridGroupByField
     gridGroupByField.FieldName = "Reg"
     gridGroupByField.HeaderText = "Reg"
     expression.SelectFields.Add(gridGroupByField)
     expression.GroupByFields.Add(gridGroupByField)
     gridJourneys.MasterTableView.GroupByExpressions.Add(expression)

Here is the aspx
<GroupByExpressions>
<telerik:GridGroupByExpression>
<SelectFields>
<telerik:GridGroupByField FieldName="Reg" HeaderText="Reg" />
</SelectFields>
<GroupByFields>
<telerik:GridGroupByField FieldName="reg" HeaderText="reg" />
</GroupByFields>
</telerik:GridGroupByExpression>
</GroupByExpressions>
Here is the error
Field Reg not found in the source table. Please check the expression syntax. 
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 
  
Exception Details: Telerik.Web.UI.GridGroupByException: Field Reg not found in the source table. Please check the expression syntax.
  
Source Error: 
  
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.  
  
Stack Trace: 
  
  
[GridGroupByException: Field Reg not found in the source table. Please check the expression syntax.]
   Telerik.Web.UI.GridDataSetHelper.CreateGroupByTable(DataTable SourceTable, GridTableView view) +376
   Telerik.Web.UI.GridEnumerableFromDataView.PerformTransformation() +2699
   Telerik.Web.UI.GridEnumerableFromDataView.TransformEnumerable() +21
   Telerik.Web.UI.GridTableView.GetEnumerator(Boolean useDataSource, GridEnumerableBase resolvedDataSource, ArrayList dataKeysArray) +105
   Telerik.Web.UI.GridTableView.CreateControlHierarchy(Boolean useDataSource) +169
   Telerik.Web.UI.GridTableView.CreateChildControls(IEnumerable dataSource, Boolean useDataSource) +499
   System.Web.UI.WebControls.CompositeDataBoundControl.PerformDataBinding(IEnumerable data) +57
   System.Web.UI.WebControls.DataBoundControl.OnDataSourceViewSelectCallback(IEnumerable data) +114
   System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +31
   System.Web.UI.WebControls.DataBoundControl.PerformSelect() +142
   Telerik.Web.UI.GridTableView.PerformSelect() +4
   System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +73
   Telerik.Web.UI.GridTableView.DataBind() +238
   Telerik.Web.UI.RadGrid.DataBind() +80
   Telerik.Web.UI.RadGrid.AutoDataBind(GridRebindReason rebindReason) +2122
   Telerik.Web.UI.RadGrid.OnLoad(EventArgs e) +121
   System.Web.UI.Control.LoadRecursive() +50
   System.Web.UI.Control.LoadRecursive() +141
   System.Web.UI.Control.LoadRecursive() +141
   System.Web.UI.Control.LoadRecursive() +141
   System.Web.UI.Control.LoadRecursive() +141
   System.Web.UI.Control.LoadRecursive() +141
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +627
  
  

This column displays the reg data just fine
<telerik:GridBoundColumn DataField="Reg" HeaderText="Reg">

I get this error no matter what field in my underlying data I try and group by

thsnks for your help

1 Answer, 1 is accepted

Sort by
0
Pavlina
Telerik team
answered on 12 Nov 2012, 06:01 PM
Hello,

Keep in mind that grouping works only with fields you have selected. Can you verify that the field you want to group by is added to the DataSource?

You can also try setting UniqueName property to the column, not only DataField and see if it makes any difference.
<telerik:GridBoundColumn DataField="Reg" UniqueName="Reg" HeaderText="Reg">

Kind regards,
Pavlina
the Telerik team
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 their blog feed now.
Tags
Grid
Asked by
andieje
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
Share this question
or