Creating SharePoint 2010 Visual WebParts - Part 2 - Sandbox Solutions

Written By: Hesham Saad -- 5/26/2011 -- join -- contribute -- (2748) comments -- printer friendly version

Rating: Rate --

Categories: Configurations, Programming and Customizations, SharePoint 2010, SharePoint Foundation 2010, Visual Studio, Web Parts

< Prev - 1 | 2 | 3 | 4 | 5 | 6 | - Next > | Become a paid author

3. Exploring and designing the created sandboxed visual web part: 

  - Now after the project is created, the Solution Explorer contains the default visual web part named "SandboxedVWP". It also has the presence of the Features and Package nodes. A
feature organizes the application in a way that SharePoint Foundation understands. Features can be deployed to SharePoint Foundation at the site or web level. The package contains features and other assets used when you deploy solutions to SharePoint Foundation.

We can change the default Feature1 name by renaming it to "SandboxedFeature" by clicking on the F2 function key or right clicking on it and selecting "rename":


  - We can change the feature scope by double clicking on the "SandboxedFeature" renamed default feature, then choosing from the Scope choices. We'll select the Site scope feature:


 - Let's explore the sandboxed visual web part by opening the "Elements.xml" file under "SandboxedVWP":


Grouping" web parts is one of the best practices that we have to follow for better management and organization of web parts, so, set the "Group" property in the Elements.xml file of web part to make sure the web parts comes under a specific group (ex: Value="MSSharePointTips"). This will make easier to find the web part from the SharePoint site. 

 - We can change the Title and Description for the sandboxed visual web part by editing the "Title" & "Description" properties in the "SandboxedWP.webpart" file:


 - Let's design our visual web part by opening the "SandboxedWP.ascx" design user control and add a "TextBox" and "Button":

 - Double click on the "Click Me" button to go to the btn_click event handler at the "code behind" file:


< Prev - 1 | 2 | 3 | 4 | 5 | 6 | - Next >

Learn more about SharePoint

Sponsor Information

Copyright (c) 2010-2017 Edgewood Solutions, LLC All rights reserved
privacy | disclaimer | copyright | advertise | contribute | feedback | about
Some names and products listed are the registered trademarks of their respective owners. |