共用方式為


Mobile Web Parts Pages and Adapters

Applies to: SharePoint Foundation 2010

This topic provides an overview of the SharePoint Foundation adapter framework for rendering Web Parts on mobile devices.

Mobile Adaption in SharePoint Foundation

Developers can make Web Part pages on SharePoint Foundation Web sites accessible to mobile devices using a variation of the mobile adapter system of Microsoft ASP.NET 3.5. The mobile adaption system in SharePoint Foundation is basically the same:

  1. When a Web Part page is requested, the Web front-end server detects, from the request header, what kind of device is making the request.

  2. If a mobile device is making the request, ASP.NET looks up each Web Part on the requested page in the compat.browser file to see what mobile adapter, if any, is associated with it.

  3. For each of the events, Init, Load, PreRender, and UnLoad(); if a Web Part has a mobile adapter, then the adapter’s handler for the event is called rather than the Web Part’s own handler, although typically the adapter’s handler will call the Web Part’s handler as part of its logic.

  4. The implementation, in SharePoint Foundation, of the adapter’s handlers for the four events checks to see if the current page is a WebPartMobilePage object. If it is, then the runtime calls the corresponding On*ForMobile method: OnLoadForMobile(EventArgs), OnInitForMobile(EventArgs), OnPreRenderForMobile(EventArgs), or OnUnloadForMobile(EventArgs).

For more information about the Microsoft ASP.NET 3.5 mobile adaption system, see Architectural Overview of Adaptive Control Behavior, Browser Definition File Schema (browsers Element), and System.Web.UI.Adapters.ControlAdapter.

Programming the SharePoint Foundation Mobile Adaption Framework

The SharePoint Foundation framework for mobile adapters is actually simpler to develop against than the Microsoft ASP.NET 3.5 mobile adaption system. As with the Microsoft ASP.NET 3.5 system, you will create a mobile adapter control for every Web Part that you want to be accessible to mobile devices, and you will map that adapter to the Web Part whose rendering it adapts in the compat.browser file.

But there are some ways in which developing with the SharePoint Foundation framework differs from mobile adapter development with Microsoft ASP.NET 3.5. For the most part these differences are needed to conform to the security model of SharePoint Foundation:

See Also

Reference

System.Web.UI.Adapters.ControlAdapter

Microsoft.SharePoint.WebPartPages.WebPartMobileAdapter

Concepts

Working with Web.config Files

Other Resources

Architectural Overview of Adaptive Control Behavior

Browser Definition File Schema (browsers Element)