Thursday, 15 November 2012

The answer is NO; you cannot since this is basically .ascx controls which needs to be stored in the "controlTemplate" folder and hence it should be a "Farm Solution".

Not to worry much..... MSDN has an answers to this, YES you can have Visual Webpart in a sandbox solution, all you need to do is to install the Visual Studio 2010 Power Tools and you will get a Visual Webpart for Sandbox Solution.

There are certain limitations however you still can use it.... Happy developing !

Known LimitationsThere are a few known limitations when using a sandboxed visual web part. These include:•JavaScript debugging is not supported in Visual Studio, although client JavaScript debugging does work •Debugging of inline ASP.NET code must be done in the generated code file rather the markup file •Use of “<@ Assembly Src=” directive is not supported •SharePoint web controls and some ASP.NET controls are not supported in the SharePoint sandboxed environment; if they are used on a sandboxed visual web part an error message similar to the following will be generated at build time: • The type or namespace name 'Theme' does not exist in the namespace 'Microsoft.SharePoint.WebControls' (are you missing an assembly reference?)