Web Part Development in Sharepoint 2010 page 1

Sunday, December 8, 2013

A freshly created team site with a couple of lists

Create a new empty sharepoint 2010 project in visual studio

Specify the sharepoint site and deploy as a farm solution

Add new item, a web part

Rename the feature

Rename the title of the feature

Override rendercontents method add this code to display hello world, press f5

Add a web part page

Select the name and layout template

Click add a web part

Default category is custom, select the web part and click add

Click stop editing and see the basic web part

The web part is located in the web part gallery

Open web.config file

Specifies that all types in this namespace are considered to be safe

Solution designer, manifest file specifies this

Web part properties has a property safe control entries, an entry has been automatically created

How to customize the add a web part page

Set the group or category where the web part will appear

Set the title and description of the web part

Remove the close verb on web part edit menu item

Also possible to set the verbs/properties in code, in the web part constructor

Navigate to web part gallery, order by date descending

Click on the link

See a sample page of what the web part looks like

Click the edit link

Possible in the ui to set the title, description and group

Site actions, site settings, all site content, site assets, click on the test web part page

In visual studio redeploy the solution

The web part is deleted from the server and then redeployed

Refresh the page, the icon has been added

Put the page in edit mode and delete the existing web part

Add web part, see that category, title and description have been applied

Add the web part, click stop editing, notice the new title and tooltip has the description

Click web part menu, edit mode, the properties are modifiable for this individual web part

Add a new item web part to the project

Set the group

In .webpart file set the title and description

The web part code, 2 fields and 3 methods, standard asp.net code

Deploy the project

Default Success Warning Important Info Inverse
B S W I ? O