A Web Part or Web Form Control on this Page cannot be displayed or imported. The type could not be found or it is not registered as safe.

When you create a Visual Webpart using Visual Studio 2010 you may see the following error:

A Web Part or Web Form Control on this Page cannot be displayed or imported. The type could not be found or it is not registered as safe.

The reason for this error is if we modify default namespace into custom namespace, Visual Studio 2010 Package is not generating webpart file properly.

1) Make sure your webpart is added into Safe Control list in Web.config file.

2) Open your .webpart file in your visual studio - Make sure type element name has proper namespace & class name.

When you made changes to default name space which is being generated by  visual studio, you may not see updated namespace in type element. So make sure your webpart name space name & webpart class name placed correctly in type element's name attribute

type name="WebpartNameSpace.WebPartClassName", $Sharepoint.Project.AssemblyFullName$

 

3) Access http://server/_layouts/newdwp.aspx page and make sure webpart exist. If webpart not shown in the list, still your webpart name space/classname not matches to your safe control entry in web.config file. 
4) Access http://server/_catalogs/wp/Forms/AllItems.aspx. By clicking on webpart opens webpart in webpart preview page.

Comments

Popular posts from this blog

Windows Azure Package Build Error: The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.

Resource ID : 1. The request limit for the database is 180 and has been reached.

Update Excel Sheet using C#, Where Excel not Installed on Server