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.
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