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

RadGrid exception

7 Answers 152 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Gary Meagher
Top achievements
Rank 1
Gary Meagher asked on 18 Nov 2010, 08:52 PM

I'm getting the following exception on a random basis.

My grid is bound to a datatable stored in the session.
I don't think it's related to session timeout...but I might be wrong...
How can I resolve the issue?

ID is neither a DataColumn nor a DataRelation for table .

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: System.ArgumentException: ID is neither a DataColumn nor a DataRelation for table .

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:

[ArgumentException: ID is neither a DataColumn nor a DataRelation for table .]
   System.Data.DataRowView.get_Item(String property) +1741034
   Telerik.Web.UI.GridTableView.PopulateDataKeys(Object dataItem) +313

[GridException: There was a problem extracting DataKeyValues from the DataSource. Please ensure that DataKeyNames are specified correctly and all fields specified exist in the DataSource.]
   Telerik.Web.UI.GridTableView.PopulateDataKeys(Object dataItem) +1188
   Telerik.Web.UI.GridItemBuilder.CreateItems(GridGroupingContext group) +524
   Telerik.Web.UI.GridTableView.CreateItems(IEnumerator enumerator, GridColumn[] columns, ControlCollection controls) +187
   Telerik.Web.UI.GridTableView.CreateControlHierarchy(Boolean useDataSource) +1573
   Telerik.Web.UI.GridTableView.CreateChildControls(IEnumerable dataSource, Boolean useDataSource) +768
   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() +38
   System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +73
   Telerik.Web.UI.GridTableView.DataBind() +354
   Telerik.Web.UI.RadGrid.DataBind() +165
   Telerik.Web.UI.RadGrid.AutoDataBind(GridRebindReason rebindReason) +3869
   Telerik.Web.UI.RadGrid.OnLoad(EventArgs e) +177
   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.Control.LoadRecursive() +141
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +627

7 Answers, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 18 Nov 2010, 10:46 PM
Hello Gary,

This error means that RadGrid is unable to find the aforementioned datakey in your datasource. Can you please post some code so that we can examine your approach? Thank you.

Best regards,
Daniel
the Telerik team
Browse the vast support resources we have to jumpstart your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
umar okeeffe
Top achievements
Rank 1
answered on 22 Aug 2011, 09:01 PM
I also get this issue, RANDOMLY, it works fine usually. 1 time it went away by itself for a week now it has returned
0
umar okeeffe
Top achievements
Rank 1
answered on 22 Aug 2011, 09:26 PM
I also get this issue, RANDOMLY, it works fine usually. 1 time it went away by itself for a week now it has returned. After an hour it has gone away again
0
Martin
Telerik team
answered on 25 Aug 2011, 09:03 AM
Hello Umar Okeeffe,

As my colleague Daniel already stated, this error means that RadGrid is unable to find the aforementioned datakey in your datasource. Could you please post some code so that I can draw a clearer picture of your scenario?

Regards,
Martin
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

0
Ronak
Top achievements
Rank 1
answered on 08 Aug 2014, 11:57 AM
Hello Martin,

I also got same issue and it was randomly generated. As Umar Okeeffe said it went away by itself.
As per your suggestion, we have already fetched value from the datasource as the datakey.
How can I solve this issue ???
Please help us.

Ronak
0
Daniel
Telerik team
answered on 11 Aug 2014, 08:52 AM
Hello Ronak,

Please post your code here so that we can examine it.

Regards,
Daniel
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Jose
Top achievements
Rank 2
answered on 27 Aug 2014, 04:32 PM
To Gary:

I've wrestled with finding the root cause of this error myself before. Seems like a problem arising from the structure of the data you're feeding into your RadGrid. Some ideas on what to check for:

1. Are there were incomplete records in the file you're using as a datasource? Particularly if it's an XML file, one or more records might be incorrectly structured and cause issues at bind time.
2. Are you attempting to handle RadGrid events (such as NeedDataSource) in an unorthodox manner? In my case I had multiple grids using the same event handler but I was improperly differentiating between the event senders and therefore running into trouble properly parsing the data files. My code was essentially attempting to populate the different grids I had with mismatched data files that didn't correspond to the grid.

So to summarize, make sure the LINQ query you're using is being fed with the right data.
Tags
Grid
Asked by
Gary Meagher
Top achievements
Rank 1
Answers by
Daniel
Telerik team
umar okeeffe
Top achievements
Rank 1
Martin
Telerik team
Ronak
Top achievements
Rank 1
Jose
Top achievements
Rank 2
Share this question
or