This article will focus on how to create SharePoint 2010 Visual Web Parts as Sandboxed Solution. In the initial release of SP 2010, the Sandboxed Solution Architecture had restriction in terms of supporting Visual Web Parts in the Sandboxed environment. This has been fixed by the recent release of Visual Studio Power Tools for SharePoint 2010, which helps to create Visual Web Parts for Sandboxed environment.
Here are the steps below :-
File –> New –> Project –> Empty SharePoint Project
Then choose ‘ Deploy as Sandboxed Solution’.
Add –> New Item –> Visual Web Part (Sandboxed)
Implement some arbitrary functionality inside the web part.
Right click on Solution Explorer –> Deploy
Now you can see the Sandboxed Solution available in the Solutions Gallery.
Event though the Visual Studio Power Tools supports Sandboxed Solution, there are some caveats/limitations around that. The following are not supported.
1. SharePoint Web Controls and some advanced ASP.NET controls
2. Use of “<@ Assembly Src=” directive is not supported
3. Java Script debugging is not supported in Visual Studio.