Put Containers and Controls in Your SharePoint 2010 Layout - dummies

Put Containers and Controls in Your SharePoint 2010 Layout

You may be wondering what goes inside content placeholders in your SharePoint 2010 page layout. Although you can place text and HTML markup inside placeholders, most often you put fields, controls, containers, and Web Parts in your page layout.

A page layout is a kind of ASP.NET page. Most any controls that you might use in an ASP.NET page are fair game for SharePoint. A most notable exception is the regular ASP.NET data source controls. SharePoint has its own data source controls that you use instead.

If you really want to get hard-core with your page layout development, get acquainted with creating websites with ASP.NET. Visual Studio Web Developer is a free download, and you can use it to get started in ASP.NET. Most of what you know in ASP.NET can be applied to SharePoint pages.

Here are multiple control types that you can put in a page layout to contain content:

  • Web Parts/Web Part zones: Web Part zones are containers that contain other containers — Web Parts. Generally, you place zones in a way that defines the page layout using a combination of HTML/CSS positioning and inserted zones.

    By default, the zones are oriented vertically; the Web Parts inserted are stacked up and down, and you can move them above or below each other. Web Part zones, however, have properties that can be set in SharePoint Designer that allow Web Parts to sit horizontally next to each other.

    In SharePoint 2010, you can insert Web Parts directly into a page layout without a zone; but remember, this should be done only when an element should be on every page using that page layout, and there are benefits to not using a zone or letting the page editors control the Web Part.

  • HTML controls: HTML controls that can be inserted include HTML markups, such as IMG tags, DIV tags, paragraph tags, and HTML form controls, such as input boxes and submit buttons. You can manually type HTML in the page layout as well.

  • ASP.NET controls: If you have .Net programming experience, you’ll recognize many of the ASP.NET controls you can insert, such as standard controls like ad rotators, calendars, and ASP.NET form controls. These also include data controls, such as grid views and data sources, validation controls, such as RequiredFieldValidator, and navigation controls.

  • SharePoint controls: Data View and server controls specific to SharePoint as well as page fields and content fields.

  • Page fields: Site columns about the page itself; for example, Comments, Content Type, and Title Scheduling Start Date.

    To assist editors, you can place some of these fields in the Edit mode panel so that they can edit while they’re editing the page instead of navigating to the page library to edit. Content shown in the Edit mode panel isn’t visible to users viewing the approved page.

  • Content controls: Controls on the page that store content, such as summary links, page image, and page content are different from Web Parts.

    Page fields and content controls are site columns in the content type associated with your page layout. Any time you want to add a new field or content control to your page layout, you must add a site column to your content type.

    Generally, SharePoint page layouts for publishing sites contain at least one content control (an HTML container) as well as Web Part zones. However, you can make additional field controls in the browser as site columns and add to page layout content types for insertion on the page.

    Other field controls that are created already for your use in page layouts (depending on whether you’re using the Article Page parent content type or the Welcome Page content type) include Page Image, Author, Byline, and so on.

What’s so special about content controls? They’re part of the publishing infrastructure and stored with the page information. That means they’re part of the versioning of the page (meaning you can revert to a previous version of content) and the approval process (meaning visitors won’t see the content until the page is approved).

Web Part information is stored with the Web Part, so after you click OK on your Web Part changes, they’re immediately visible.