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

Unable to cast object of type 'Telerik.Web.UI.GridTableRow' to type 'Telerik.Web.UI.GridItem'.

4 Answers 218 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Jonathan Miller
Top achievements
Rank 1
Jonathan Miller asked on 25 Jun 2008, 03:29 PM
Hi

I am new with Telerik controls.  They seem simple enough, but I am having an issue with the RadGrid.

When binding data to my RadGrid, I receive this message:
Unable to cast object of type 'Telerik.Web.UI.GridTableRow' to type 'Telerik.Web.UI.GridItem'.

Here is my aspx code:
<telerik:RadGrid ID="ugMessages" runat="server"></telerik:RadGrid> 

Here is my .cs code:
ugMessages.DataSource = ds.Tables[0];  
ugMessages.DataBind(); 

Stack trace:
Server Error in '/pcs' Application.  
--------------------------------------------------------------------------------  
 
Unable to cast object of type 'Telerik.Web.UI.GridTableRow' to type 'Telerik.Web.UI.GridItem'.   
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.InvalidCastException: Unable to cast object of type 'Telerik.Web.UI.GridTableRow' to type 'Telerik.Web.UI.GridItem'.  
 
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:   
 
 
[InvalidCastException: Unable to cast object of type 'Telerik.Web.UI.GridTableRow' to type 'Telerik.Web.UI.GridItem'.]  
   Telerik.Web.UI.GridTableRow.get_ClientID() +86  
   Coolite.Utilities.<>c__DisplayClass1.<FindControlByClientID>b__0(Control c) +37  
   Coolite.Utilities.ControlUtils.RecurseControls(ControlCollection controls, FindControlDelegate callback) +131  
   Coolite.Utilities.ControlUtils.RecurseControls(ControlCollection controls, FindControlDelegate callback) +181  
   Coolite.Utilities.ControlUtils.RecurseControls(ControlCollection controls, FindControlDelegate callback) +181  
   Coolite.Utilities.ControlUtils.RecurseControls(ControlCollection controls, FindControlDelegate callback) +181  
   Coolite.Utilities.ControlUtils.RecurseControls(ControlCollection controls, FindControlDelegate callback) +181  
   Coolite.Utilities.ControlUtils.RecurseControls(ControlCollection controls, FindControlDelegate callback) +181  
   Coolite.Utilities.ControlUtils.RecurseControls(ControlCollection controls, FindControlDelegate callback) +181  
   Coolite.Utilities.ControlUtils.RecurseControls(ControlCollection controls, FindControlDelegate callback) +181  
   Coolite.Utilities.ControlUtils.RecurseControls(ControlCollection controls, FindControlDelegate callback) +181  
   Coolite.Utilities.ControlUtils.RecurseControls(ControlCollection controls, FindControlDelegate callback) +181  
   Coolite.Utilities.ControlUtils.RecurseControls(ControlCollection controls, FindControlDelegate callback) +181  
   Coolite.Utilities.ControlUtils.RecurseControls(ControlCollection controls, FindControlDelegate callback) +181  
   Coolite.Utilities.ControlUtils.RecurseControls(ControlCollection controls, FindControlDelegate callback) +181  
   Coolite.Utilities.ControlUtils.RecurseControls(ControlCollection controls, FindControlDelegate callback) +181  
   Coolite.Utilities.ControlUtils.FindControlByClientID(ControlCollection controls, String clientID) +95  
   Coolite.Utilities.ControlUtils.FindControl(ControlCollection controls, String idOrClientID) +35  
   Coolite.Ext.Web.Window.OnBeforeClientInit(Component sender) +254  
   Coolite.Ext.Web.Component.OnBeforeClientInitHandler() +35  
   Coolite.Ext.Web.Component.OnClientInit() +26  
   Coolite.Ext.Web.WebControl.SetResources() +81  
   Coolite.Ext.Web.WebControl.OnPreRender(EventArgs e) +108  
   System.Web.UI.Control.PreRenderRecursiveInternal() +86  
   System.Web.UI.Control.PreRenderRecursiveInternal() +170  
   System.Web.UI.Control.PreRenderRecursiveInternal() +170  
   System.Web.UI.Control.PreRenderRecursiveInternal() +170  
   System.Web.UI.Control.PreRenderRecursiveInternal() +170  
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2041  
 
   
 
 
--------------------------------------------------------------------------------  
Version Information: Microsoft .NET Framework Version:2.0.50727.1433; ASP.NET Version:2.0.50727.1433  

Any ideas?

4 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 26 Jun 2008, 07:00 AM
Hi Jonathan Miller,

Try binding the Grid using AdvanceDataBinding techniques.
Advanced data-binding

Shinu.


0
Yaser
Top achievements
Rank 1
answered on 05 Oct 2008, 03:55 PM
Hi Jonathan

Actully I'm having the same problem, and I'm using Coolite Suite as well. I'm trying to figure out the problem but with no luck. Did you come up with any possible solution to this issue? I dont know of AdvancedDataBinding might work, I'll just give it a shot. Thanks for your attention
0
Yavor
Telerik team
answered on 06 Oct 2008, 05:31 AM
Hi Yaser,

The advanced databinding approach should alleviate the issue at your end. If it does not, you can open a formal support ticket, and send us the problematic code, for further review.

Greetings,
Yavor
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Jonathan Miller
Top achievements
Rank 1
answered on 06 Oct 2008, 01:06 PM
Hi Yaeser

With the controls, I was never able to resolve this with Telerik databinding. (Infragistics worked fine)

I haven't tried version 6.0, but Coolite 6.0 will probably be able to replace everything here.

I would recommend using only 1 of the 2 vendors for streamline.

Also, we were using SSL.  I found that Coolite has a great look, but over SSL was unaccecptably slow.  We have redesigned our products for Silverlight 2, now just waiting on Microsoft for final release.

Though it's a learning curve and change from Ajax to Silverlight 2, you'll find no javascript considerations are needed for future browser releases, thus saving you future development cost.

Good luck, sorry I couldn't help further
-jonathan
Tags
Grid
Asked by
Jonathan Miller
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Yaser
Top achievements
Rank 1
Yavor
Telerik team
Jonathan Miller
Top achievements
Rank 1
Share this question
or