How to create Visual web part using Sandbox solution in SharePoint 2010

In this article we will be seeing how to create a Visual Web Part using Sandbox solution in SharePoint 2010.

Generally when you try to create a Visual web part you won't be seeing an option to deploy as a sandbox solution, this is because standard Visual Web Part is not supported in the sandbox environment. Visual Web Parts effectively host an ASCX user control within the Web Part control and ASCX file is deployed to the _controltemplates virtual directory in the physical file system. You cannot use a sandbox solution to deploy a visual web part using visual studio 2010 Visual Web Part project template because sandbox solution does not allow deployi