Export (0) Print
Expand All
2 out of 5 rated this helpful - Rate this topic

SPControl Class

Windows SharePoint Services 3

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
      

Namespace:  Microsoft.SharePoint.WebControls
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)
[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);

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
System.Object
  System.Web.UI.Control
    Microsoft.SharePoint.WebControls.SPControl
      Microsoft.SharePoint.WebControls.AlphaImage
      Microsoft.SharePoint.WebControls.BpScript
      Microsoft.SharePoint.WebControls.CssLink
      Microsoft.SharePoint.WebControls.CssRegistration
      Microsoft.SharePoint.WebControls.CustomJSUrl
      Microsoft.SharePoint.WebControls.DelegateControl
      Microsoft.SharePoint.WebControls.FormattedString
      Microsoft.SharePoint.WebControls.FormDigest
      Microsoft.SharePoint.WebControls.GroupPermissions
      Microsoft.SharePoint.WebControls.ListFormPageTitle
      Microsoft.SharePoint.WebControls.ListItemProperty
      Microsoft.SharePoint.WebControls.ListProperty
      Microsoft.SharePoint.WebControls.Navigation
      Microsoft.SharePoint.WebControls.OWSControl
      Microsoft.SharePoint.WebControls.OWSForm
      Microsoft.SharePoint.WebControls.PortalConnection
      Microsoft.SharePoint.WebControls.PreReleaseFeedback
      Microsoft.SharePoint.WebControls.ProjectProperty
      Microsoft.SharePoint.WebControls.RelatedTasks
      Microsoft.SharePoint.WebControls.ReturnLink
      Microsoft.SharePoint.WebControls.RobotsMetaTag
      Microsoft.SharePoint.WebControls.RssLink
      Microsoft.SharePoint.WebControls.ScriptLink
      Microsoft.SharePoint.WebControls.SoapDiscoveryLink
      Microsoft.SharePoint.WebControls.SPCalendarNavigator
      Microsoft.SharePoint.WebControls.TemplateBasedControl
      Microsoft.SharePoint.WebControls.Theme
      Microsoft.SharePoint.WebControls.UrlRedirector
      Microsoft.SharePoint.WebControls.ViewSearchForm
      Microsoft.SharePoint.WebControls.ViewSelector
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.