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

SharePoint: ServerContext not set to an instance

I was playing through SharePoint object model and somewhere (don’t remember right now!) got an exception stating “ServerContext not set to an instance”.

My solution for this: Installed SSP (Shared Services Provider) and this problem is solved!
[ Edited:2008-03-24
I got this error while playing with stsadm.exe command
]

Useful add-ons (plugins) for Visual Studio 2005

Extensibility of Visual Studio 2005 made developers to write custom tools, aka plugins, making your everyday tasks simpler. Here are few must have tools:

  1. Visual Studio Add-Ins Every Developer Should Download Now, SmartPaster is very handful
  2. Create a Debugger Visualizer in 10 Lines of Code: Explains writing debug visualizer. If you cannot read article, downloading binaries and installing the image visualizer would be surely helpful.
  3. Line Counter
  4. Opening solution folder, See class definition on MSDN2, Search in Google – All of these available at single right click,
  5. Visual Studio IDE enhancements: Switch between C/CPP and H files, find document in the Solution Explorer, Cut and copy (plain text only)
  6. Free SlickEdit® Gadgets: Auto-copy selection, Line ruler, Indentation guide
  7. ZipStudio: Create Zip of you solution with single right click
  8. Visual Studio 2005 add-in for sorting imports/using blocks
  9. Resource Refactoring Tool: provides developers an easy way to extract hard coded strings from the code to resource files (donkey work ;) )
  10. Refactor! for ASP.NET 2.0 : 25 advanced refactoring tools in one package.

- Ankit

Foxit - PDF Reader

Q: How many times in a day you wait for Adobe Acrobat Reader to load?

A: Almost 2-5 items a day, as I’m an avid Internet user. Let me list down where Acrobat Reader sucks:

  1. The Adobe Reader 8 installer a massive 20.8MB setup to download and time consuming setup.
  2. Version 5 was roughly fast whereas new versions are becoming more memory hungry and CPU intensive and version 7 is damn hungry. It takes almost 10-15 seconds to load!
  3. Frankly speaking, I hate their patents listed in splash screen.
  4. If a PDF file has high graphics it sucks further and application hangs for few seconds.
  5. Seriously I’m looking for a replacement!

Hmmm… a serious problem that affects my efficiency directly. Let’s search for a better solution. Wow I got it as first result!

Foxit v2.0 is the answer to all my worries. It’s a free light-weight (only 1.5 MB) and amazingly fast PDF viewer and printer. A 19 MB PDF file when opened, virtual memory required by Foxit was just 10 MB against massive 23 MB for Acrobat Reader.

Even the installer is just an extractor and does not require specific permissions to install. Quite handy in cybercafé. Its user interface is same as Acrobat reader and you won’t feel using a different viewer.

- Ankit