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

InvalidCastException on displaying RadGrid in designer

11 Answers 436 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Klemen Slavič
Top achievements
Rank 2
Klemen Slavič asked on 09 Nov 2009, 08:12 AM
I've got a problem I don't know quite how to resolve; I've used Telerik AJAX controls on other parts of the site, but since I've upgraded to a newer version (Q3) and reregistered the reference, this error keeps popping up in the designer:

Error creating template groups. Reason: System.InvalidCastException: [A]Telerik.Web.UI.RadGrid cannot be cast to [B]Telerik.Web.UI.RadGrid. Type A originates from 'Telerik.Web.UI, Version=2009.3.1103.35, Culture=neutral, PublicKeyToken=121fae78165ba3d4' in the context 'LoadNeither' at location 'c:\Users\klemens\AppData\Local\Microsoft\Visual Studio\9.0\ProjectAssemblies\gm17spra01\telerik.web.ui.dll'. Type B originates from 'Telerik.Web.UI, Version=2009.3.1103.35, Culture=neutral, PublicKeyToken=121fae78165ba3d4' in the context 'LoadNeither' at location 'c:\Users\klemens\AppData\Local\Microsoft\Visual Studio\9.0\ProjectAssemblies\e9yumfmq01\Telerik.Web.UI.dll'.

at Telerik.Web.Design.RadGridDesigner.get_GridComponent()
at Telerik.Web.Design.RadGridDesigner.get_TemplateGroups()

Whenever I upgrade to a newer release of Telerik, I always uninstall the controls first, then install a newer version, but the version numbers in this case match, so I don't quite know how two different project assemblies got into the project in the first place.

11 Answers, 1 is accepted

Sort by
0
Pavlina
Telerik team
answered on 09 Nov 2009, 11:43 AM
Hi Klemen,

I think that you can find the information you need in the following public forum thread on our site:
http://www.telerik.com/community/forums/aspnet-ajax/general-discussions/ajax-2-9-q2-release-giving-me-gray-hair.aspx

If you need additional assistance, do not hesitate to let us know.
 
Greetings,
Pavlina
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Klemen Slavič
Top achievements
Rank 2
answered on 09 Nov 2009, 01:14 PM
I've cleared the contents of my AppData\Local\Microsoft\VisualStudio\9.0\ProjectAssemblies and restarted Visual Studio, to no avail. I've checked the references in the project – I am using ASP.NET 3.5 with Telerik 2009 Q3 with the UI dll from Bin35.

The problem is only regarding the designer, not the actual site running, but Visual Studio isn't offering any intellisense or attribute list for RadGrid in source view.
0
Pavlina
Telerik team
answered on 09 Nov 2009, 01:34 PM
Hi Klemen,

Based on this information, it is hard to determine what is causing this behavior. If the issue persists, you can open a formal support ticket, and send us a small working project, demonstrating the unwanted behavior. We will review it locally, and advise you further.

Sincerely yours,
Pavlina
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Klemen Slavič
Top achievements
Rank 2
answered on 09 Nov 2009, 01:48 PM
Ah, it seems I've managed to finally make it work.

I've followed the advice given in the previously mentioned thread and deleting the project assemblies, then deleting the contents of the ASP.NET 2.0 temporary folder in the %windows%\Microsoft.NET\Framework64\v2.0.50727 directory.

Next, I deleted all the files in the project's bin directory.

I started up Visual Studio and opened the aspx file in question in code view and deleted the <%@ Register  %> directive, then rebuilt the project. after that, I waited for all of the <telerik:*> tabs to underline (unknown tag), then added the Register directive to the page and waited for the green squiggly lines to dissapear.

Switching to design view then made the designer load up correctly and RadGrid is now available in the designer as well.
0
Pavlina
Telerik team
answered on 09 Nov 2009, 02:23 PM
Hello Klemen,

I am happy to hear that the information provided in the forum thread helped you to solve the problem.
Do not hesitate to contact us if other questions or problems arise.

Greetings,
Pavlina
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Wayne
Top achievements
Rank 1
answered on 27 Feb 2013, 07:58 PM
I am having the same problem with a fresh Telerik controls install on Visual Studio 2012.

---------------------------

---------------------------
Error creating template groups. Reason: System.InvalidCastException: [A]Telerik.Web.UI.RadGrid cannot be cast to [B]Telerik.Web.UI.RadGrid. Type A originates from 'Telerik.Web.UI, Version=2013.1.220.45, Culture=neutral, PublicKeyToken=121fae78165ba3d4' in the context 'LoadNeither' at location 'C:\Users\Wayne Blackmon\AppData\Local\Microsoft\VisualStudio\11.0\ProjectAssemblies\yihusiqu01\Telerik.Web.UI.dll'. Type B originates from 'Telerik.Web.UI, Version=2013.1.220.45, Culture=neutral, PublicKeyToken=121fae78165ba3d4' in the context 'LoadNeither' at location 'C:\Users\Wayne Blackmon\AppData\Local\Microsoft\VisualStudio\11.0\ProjectAssemblies\l_vfyou_01\Telerik.Web.UI.dll'.

   at Telerik.Web.Design.RadGridDesigner.get_TemplateGroups()
---------------------------
OK  
---------------------------

This is a really annoying error.   I am unable to connect to the web page above.

0
Pavlina
Telerik team
answered on 04 Mar 2013, 04:07 PM
Hello Wayne,

I recommend that you examine the help article below which elaborates on this matter and let me know if it helps to resolve this error:
Design-time Troubleshooting (An unhandled exception has occurred. [A][control type] cannot be cast to [B][control type] section)

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.
0
Paul
Top achievements
Rank 1
answered on 08 Aug 2013, 11:41 AM
The link does not go anywhere.
0
Maria Ilieva
Telerik team
answered on 12 Aug 2013, 11:51 AM
Hello Paul,

The previously provided link works correctly on my end. Test it again and verify if it works for you now:
http://www.telerik.com/help/aspnet-ajax/introduction-design-time-troubleshooting.html

Regards,
Maria Ilieva
Telerik
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 the blog feed now.
0
Justin
Top achievements
Rank 1
answered on 27 Nov 2013, 02:29 PM
I am having this problem as well.  It seems I am constantly fighting with the Telerik assemblies...  Why can't I just add the reference and start working??!!
0
Pavlina
Telerik team
answered on 29 Nov 2013, 06:49 PM
Hello Justin,

Can you please check whether clearing your VS cache and restarting your development environment addresses the issue you encountered? You may also check whether you have a valid reference to the Telerik.Web.Design.dll either in the /bin folder of your project or in the GAC on your machine.

Regards,
Pavlina
Telerik
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 the blog feed now.
Tags
Grid
Asked by
Klemen Slavič
Top achievements
Rank 2
Answers by
Pavlina
Telerik team
Klemen Slavič
Top achievements
Rank 2
Wayne
Top achievements
Rank 1
Paul
Top achievements
Rank 1
Maria Ilieva
Telerik team
Justin
Top achievements
Rank 1
Share this question
or