SIGN UP MEMBER LOGIN:    
ARTICLE

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

Posted by Vijai Anand Articles | SharePoint March 23, 2011
In this article we will be seeing how to create a Visual Web Part using Sandbox solution in SharePoint 2010.
Reader Level:

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 deploying files in the 14 hive.

Visual web part can be created using sandbox solution by installing the Visual Studio 2010 SharePoint Power Tools (http://visualstudiogallery.msdn.microsoft.com/8e602a8c-6714-4549-9e95-f3700344b0d9/).

Download Visual Studio 2010 SharePoint Power Tools and install the tool.

Create a visual web part:

  • Open Visual Studio 2010.
  • Create an Empty SharePoint solution.
  • Right click the solution and add a new item.
  • You could see a new template called "Visual Web Part (Sandboxed)".

    share1.gif
     
  • Select the template, enter the name and click on Add.
  • The solution looks like the following.

    share2.gif
     
  • I have added a button and a label.
  • .Cs file looks like the following.

    share3.gif
     
  • Build and deploy the solution.
  • Go to the SharePoint site and add the visual web part.

    share4.gif

    • You could see the web part is added successfully.

    share5.gif

 

Login to add your contents and source code to this article
share this article :
post comment
 

what is certificate, how it is useful to create https:// sites (SSL). can you please explain about creating a https:// site. Thanks&Regards, Sreekanth Reddy.

Posted by Sreekanth Reddy May 03, 2011

Hi Vijai, its nice article, here i have one question that how to give permissions to the user for the visual webpart in sharepoint foundation 2010? Thanks & Regards, Ankit

Posted by Ankit Gandhi May 02, 2011
Become a Sponsor
PREMIUM SPONSORS
  • Finally – a virtual platform that delivers next-generation Windows Server 2008 Hyper-V virtualization technology from a managed hosting partner you can truly depend on. Visit www.maximumasp.com/max for a FREE 30 day trial. Hurry offer ends soon. Climb aboard the MaxV platform and take advantage of High Availability, Intelligent Monitoring, Recurrent Backups, and Scalability – with no hassle or hidden fees. As a managed hosting partner focused solely on Microsoft technologies since 2000, MaximumASP is uniquely qualified to provide the superior support that our business is built on. Unparalleled expertise with Microsoft technologies lead to working directly with Microsoft as first to offer IIS 7 and SQL 2008 betas in a hosted environment; partnering in the Go Live Program for Hyper-V; and product co-launches built on WS 2008 with Hyper-V technology.
    Get 2 Months Free of ASP.NET Hosting for Only $4.95/month! Receive FREE MS SQL and MySQL Databases Including ASP.NET 4/3.5, MVC 3.0, Silverlight 4, Windows 2008/IIS 7.0 Plus FREE IIS 7 Modules. Host UNLIMITED ASP.NET Web Sites - Click Here!
Nevron Gauge for SharePoint
Become a Sponsor