Error loading the webpart '' of type ''

kyle shapiro asked on June 23, 2017 20:11

Hi all, quick question: Know of any common issues that will cause the "Error loading the webpart 'your_webpart' of type 'your_webpart'" error on design tab / mode? I have this for two custom webparts I made. It seems as though the more simple webparts don't trigger this error, but once they reach a certain level of complexity, they do. The webparts with this error display fine on page tab, and perform perfectly on the website, just in design mode they show this error. Thank you.

Correct Answer

kyle shapiro answered on June 25, 2017 16:40

Hi all. Thank you for the suggestion of the underscores Suneel. I agree and have made this change. I did additional troubleshooting and found the source of my problem. If at anywhere in the aspx page i call out to the code behind with <%= ____ %> it causes the design mode to show "Error loading the webpart __ of type __". I don't know the details of how Kentico accomplishes their webparts without calls to the code behind, but I do see <cms:BasicBingMaps ID="ucBingMap" runat="server" />. This is a CMS control, and I never wrote a custom CMS control for my custom web-part. If anybody else runs into this, please check your aspx file of your custom webpart to see if you're making any calls directly to the code behind file using <%= ____ %>.

0 votesVote for this answer Unmark Correct answer

Recent Answers

Brenden Kehren answered on June 23, 2017 20:27

Do you have custom layouts for the webparts? Are the path's to the .cs file fully relative and show the full path and not just the name of the file?

1 votesVote for this answer Mark as a Correct answer

kyle shapiro answered on June 23, 2017 22:48

Hi Brenden, I think the answer to custom layouts is yes? I have a lot of xml and javascript written from the ascx file of my custom webpart. My path looks like this

<%@ Control Language="C#" AutoEventWireup="true" CodeFile="~/CMSWebParts/MyWebParts/Bing Map v8.ascx.cs" Inherits="CMSWebParts_MyWebParts_Bing_Map_v8" %>
0 votesVote for this answer Mark as a Correct answer

Suneel Jhangiani answered on June 25, 2017 11:01

The error typically indicates that some data may not necessarily be available to the web part in the design view (ie. you put the web part on a page template that displays data based on being used on a nested page). In this case you should put a check for the 'IsDesign' property and if true then display alternative content.

Also as a point to note here, in the control definition you posted, the path to codefile indicates that you have used spaces in the filename. In some cases this may lead to other errors due to the fact that the spaces would need to be encoded and hence I recommend you change these to an underscore ('_') - this would be especially true if you use a space in the filename of an ASPX page since a link to the page would need to be like instead of " long filename.aspx".

1 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.