Compartilhar via


SPControl Class

The SPControl class provides methods for getting or setting the context of the request and serves as the base server control from which other controls in the Microsoft.SharePoint.WebControls namespace derive.

System.Object

   System.Web.UI.Control

      Microsoft.SharePoint.WebControls.SPControl

Public Constructors

The following table shows the public constructors of the SPControl class and a brief description of each.

Name Description
SPControl Initializes a new instance of the SPControl class.

Public Methods

The following table shows the public methods of the SPControl class and a brief description of each.

Name Description
GetContextModule Returns the module that serves as context for the request.
GetContextSite Returns the site collection that serves as context for the request.
GetContextWeb Returns the Web site that serves as context for the request.
GetDesignTimeHtml Returns the control as design-time HTML for editing in Web site development tools such as Microsoft Office FrontPage 2003.
SetContextSite Sets the site collection that serves as context for the request.
SetContextWeb Sets the Web site that serves as context for the request.

Public Properties

The following table shows the public properties of the SPControl class, the data type of each property, and a brief description of each.

Name Data Type Description
PageUri System.Uri Gets or sets the Uniform Resource Identifier (URI) of the page that contains the control.

Example

The following code example returns both a site collection object and a site object.

Thread Safety

Any public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Any instance members are not guaranteed to be thread safe.

Requirements

Namespace: Microsoft.SharePoint.WebControls

Platforms: Microsoft Windows Server 2003

Assembly: Windows SharePoint Services (in Microsoft.SharePoint.dll)

Security: Code Access Security