Click to Rate and Give Feedback
Community Content
In this section
Statistics Annotations (5)
Collapse All/Expand All Collapse All
This page is specific to
The 2007 product release

Other versions are also available for the following:
SPControl Class (Microsoft.SharePoint.WebControls)
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.

Namespace: Microsoft.SharePoint.WebControls
Assembly: Microsoft.SharePoint (in microsoft.sharepoint.dll)
Visual Basic (Declaration)
<DesignerAttribute(GetType(SPControlDesigner))> _
<SharePointPermissionAttribute(SecurityAction.InheritanceDemand, ObjectModel:=True)> _
<AspNetHostingPermissionAttribute(SecurityAction.InheritanceDemand, Level:=AspNetHostingPermissionLevel.Minimal)> _
<SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel:=True)> _
<AspNetHostingPermissionAttribute(SecurityAction.LinkDemand, Level:=AspNetHostingPermissionLevel.Minimal)> _
Public Class SPControl
    Inherits Control
    Implements IDesignTimeHtmlProvider, IDesignerEventAccessor
Visual Basic (Usage)
Dim instance As SPControl
C#
[DesignerAttribute(typeof(SPControlDesigner))] 
[SharePointPermissionAttribute(SecurityAction.InheritanceDemand, ObjectModel=true)] 
[AspNetHostingPermissionAttribute(SecurityAction.InheritanceDemand, Level=AspNetHostingPermissionLevel.Minimal)] 
[SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel=true)] 
[AspNetHostingPermissionAttribute(SecurityAction.LinkDemand, Level=AspNetHostingPermissionLevel.Minimal)] 
public class SPControl : Control, IDesignTimeHtmlProvider, IDesignerEventAccessor

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

[Visual Basic .NET]
Dim siteCollection As SPSite = SPControl.GetContextSite(Context)
Dim site As SPWeb = SPControl.GetContextWeb(Context)
[C#]
SPSite siteCollection = SPControl.GetContextSite(Context); 
SPWeb site = SPControl.GetContextWeb(Context);
System.Object
   System.Web.UI.Control
    Microsoft.SharePoint.WebControls.SPControl
       Derived Classes
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks | Privacy Statement | Site Feedback
Page view tracker