Redigera

Dela via


IWebEditable.WebBrowsableObject Property

Definition

Gets a reference to the WebPart control, user control, or custom control that will be edited by EditorPart controls.

public:
 property System::Object ^ WebBrowsableObject { System::Object ^ get(); };
public object WebBrowsableObject { get; }
member this.WebBrowsableObject : obj
Public ReadOnly Property WebBrowsableObject As Object

Property Value

An object reference to the control associated with an EditorPart control.

Examples

The following code example demonstrates how the WebBrowsableObject property can be overridden in a custom WebPart control. The complete source code required to run the example is found in the Example section of the IWebEditable class overview topic.

The code example overrides both members of the IWebEditable interface.

public override EditorPartCollection CreateEditorParts()
{
  ArrayList editorArray = new ArrayList();
  TextDisplayEditorPart edPart = new TextDisplayEditorPart();
  edPart.ID = this.ID + "_editorPart1";
  editorArray.Add(edPart);
  EditorPartCollection editorParts = 
    new EditorPartCollection(editorArray);
  return editorParts;
}

public override object WebBrowsableObject
{
  get { return this; }
}
Public Overrides Function CreateEditorParts() _
                            As EditorPartCollection
  Dim editorArray As New ArrayList()
  Dim edPart as New TextDisplayEditorPart()
  edPart.ID = Me.ID & "_editorPart1"
  editorArray.Add(edPart)
  Dim editorParts As New EditorPartCollection(editorArray)
  Return editorParts

End Function

Public Overrides ReadOnly Property WebBrowsableObject() _
                                    As Object
  Get
    Return Me
  End Get
End Property

Remarks

The WebBrowsableObject property provides a way for EditorPart controls to get a reference to the server controls they are associated with.

Although the property itself is read-only, the object reference that it returns enables EditorPart controls to change values in the server control.

Notes to Implementers

Normally, when you implement the WebBrowsableObject property in a server control, you simply return a reference to the server control itself. In the case of the GenericWebPart class, because it wraps a child control to enable it to function as a WebPart control, its implementation of the WebBrowsableObject property returns a reference to the child control.

Applies to

See also