Creating a Mobile Web Part

Version: 1.0.0

Description

SharePoint can render content on pages in two ways, normal and mobile view. There may be cases when a custom Web part needs to render differently when viewed in a mobile browser.

Overview

SharePoint can render content on pages in two ways, normal and mobile view. There may be cases when a custom Web part needs to render differently when viewed in a mobile browser. In the previous lab you saw how the compat.browser file can automatically change the render mode for Windows Phone 7 to redirect the user to the SharePoint Mobile View. In this lab you will create a SharePoint Web Part that changes the rendered content when viewed in a mobile browser. When the feature for the Web Part is activated your code will update the compat.browser file to create a mapping for the Mobile Adapter to change the rendering of the Web Part.

Objectives

In this hands-on lab, you will learn how to:

  • Add a mobile adapter to an existing Web part
  • Create a Feature Receiver that updates the compat.browser file to register the mobile control adapter
  • Test the two views of a mobile web part

Prerequisites

The following is required to complete this hands-on lab:

Note:
See Setting Up A SharePoint and Windows Phone 7 Development Environment Module for instructions that describe how to set up the SharePoint and Windows Phone 7 developer machine.

  • Windows 7 x64 installed with all Windows Updates installed, in one of the following scenarios.
    • Installed on a physical machine
    • Installed on a bootable VHD
  • SharePoint 2010 installed on the Windows 7 x64 developer machine configured with a site collection that uses Forms Based Authentication (FBA).
Note:
The following prerequisites are not included in the Setting Up A SharePoint and Windows Phone 7 Development Environment Module installation instructions. If you are using a development machine built according to the Setting Up A SharePoint and Windows Phone 7 Development Environment Module instructions you must install these components.