Skip to content

Checklist: Cannot import webpart

 

While importing (drag/drop) your webpart to any SharePoint page, if you receive an error stating “Cannot import webpart” or “unable to add selected web part(s)”! here is the check list you should look for:

  1. Make sure the webpart class is inherited either from Microsoft.SharePoint.WebPartPages.WebPart or System.Web.UI.WebControls.WebParts.WebPart
  2. The webpart class needs to be declared public.
  3. Safe controls entry in web.config file.
  4. If you are referring a webpart from GAC (i.e. assembly containing webpart class is placed in GAC) make sure the GAC version is the latest build and IIS is re-started.

- Ankit

4 Comments

  1. Shoaib Adil

    i’ve tried n checked all of it but the error is still coming :(

    Posted on 04-Dec-08 at 12:28 pm | Permalink
  2. Wail Makhoul

    Genuis! Inheriting from Microsoft.Sharepoint.WebpartPages.WebPart did it for me. There are obviously other things that you could do to fix the error like checking web.config file for a safecontrol entry…etc, but definitely put me the right direction as I was inheriting from System.Web.WebControls initially.

    Posted on 11-Jan-10 at 8:09 am | Permalink
  3. Carol

    Hi

    After declaring the Web Part class as Public, it worked for me!!
    Thanks for your solution.

    Thanks
    Carol

    Posted on 20-Feb-10 at 4:49 am | Permalink
  4. This is a most useful contribuiton to the debate

    Posted on 08-Oct-12 at 2:57 pm | Permalink

One Trackback/Pingback

  1. [...] are a few ways to remediate this SharePoint [...]

Post a Comment

Your email is never published nor shared. Required fields are marked *
*
*

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word