Export (0) Print
Expand All

WebPartMobileAdapter.Control Property

SharePoint 2010

Gets the Web Part that is being adapted.

Namespace:  Microsoft.SharePoint.WebPartPages
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: No

protected WebPart Control { get; }

Property Value

Type: System.Web.UI.WebControls.WebParts.WebPart
The Web Part that is being adapted.

If the adapted Web Part is an Microsoft.SharePoint.WebPartPages.WebPart, it is cast to System.Web.UI.WebControls.WebParts.WebPart and returned.

Notes to Inheritors

If you override CreateControlsForSummaryView(), CreateControlsForDetailView(), or some other method, and your logic requires access to the members of the Web Part that is being adapted that it does not inherit from System.Web.UI.WebControls.WebParts.WebPart, consider hiding Control in your derived class by declaring a Control property, using the new keyword. Your new property casts the Web Part that is being adapted back to its specific Web Part type. An example of doing this is below. For more information about hiding member (which is called ‘shadowing’ in Visual Basic) see 3.7.1.2 Hiding through inheritance and Shadowing in Visual Basic.

The following is an example of hiding and replacing the Control property with a property that casts the Web Part back to its specific type.


protected new SomeWebPart Control
{
    get { return base.Control as SomeWebPart; }
}

Community Additions

ADD
Show:
© 2014 Microsoft