InvalidCastException on displaying RadGrid in designer

12 posts, 0 answers
  1. Klemen Slavič
    Klemen Slavič avatar
    21 posts
    Member since:
    Jul 2009

    Posted 09 Nov 2009 Link to this post

    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.
  2. Pavlina
    Admin
    Pavlina avatar
    6084 posts

    Posted 09 Nov 2009 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Klemen Slavič
    Klemen Slavič avatar
    21 posts
    Member since:
    Jul 2009

    Posted 09 Nov 2009 Link to this post

    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.
  5. Pavlina
    Admin
    Pavlina avatar
    6084 posts

    Posted 09 Nov 2009 Link to this post

    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.
  6. Klemen Slavič
    Klemen Slavič avatar
    21 posts
    Member since:
    Jul 2009

    Posted 09 Nov 2009 Link to this post

    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.
  7. Pavlina
    Admin
    Pavlina avatar
    6084 posts

    Posted 09 Nov 2009 Link to this post

    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.
  8. Wayne
    Wayne avatar
    1 posts
    Member since:
    Feb 2013

    Posted 27 Feb 2013 Link to this post

    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.

  9. Pavlina
    Admin
    Pavlina avatar
    6084 posts

    Posted 04 Mar 2013 Link to this post

    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.
  10. Paul
    Paul avatar
    1 posts
    Member since:
    Mar 2011

    Posted 08 Aug 2013 Link to this post

    The link does not go anywhere.
  11. Maria Ilieva
    Admin
    Maria Ilieva avatar
    4017 posts

    Posted 12 Aug 2013 Link to this post

    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.
  12. Justin
    Justin avatar
    2 posts
    Member since:
    Jan 2013

    Posted 27 Nov 2013 Link to this post

    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??!!
  13. Pavlina
    Admin
    Pavlina avatar
    6084 posts

    Posted 29 Nov 2013 Link to this post

    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.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017