IWebEditable.WebBrowsableObject 属性

定义

获取对将由 WebPart 控件编辑的 EditorPart 控件、用户控件或自定义控件的引用。

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

属性值

EditorPart 控件的关联控件的对象引用。

示例

下面的代码示例演示如何 WebBrowsableObject 在自定义 WebPart 控件中重写 属性。 运行示例所需的完整源代码位于类概述主题的 IWebEditable “示例”部分。

代码示例重写 接口的 IWebEditable 两个成员。

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

注解

属性 WebBrowsableObject 为 控件提供了一种方法 EditorPart ,用于获取对与其关联的服务器控件的引用。

尽管属性本身是只读的,但它返回的对象引用使控件能够 EditorPart 更改服务器控件中的值。

实施者说明

通常,在服务器控件中实现 WebBrowsableObject 属性时,只需返回对服务器控件本身的引用。 对于 GenericWebPart 类,因为它包装子控件以使子控件能够作为控件 WebPart 运行,因此其 属性的 WebBrowsableObject 实现将返回对子控件的引用。

适用于

另请参阅