Editare

Partajați prin


WebBrowsableAttribute Constructors

Definition

Initializes a new instance of the WebBrowsableAttribute class.

Overloads

WebBrowsableAttribute()

Initializes a new instance of the WebBrowsableAttribute class with the Browsable property set to true.

WebBrowsableAttribute(Boolean)

Initializes a new instance of the WebBrowsableAttribute class with the specified value for the Browsable property.

WebBrowsableAttribute()

Initializes a new instance of the WebBrowsableAttribute class with the Browsable property set to true.

public:
 WebBrowsableAttribute();
public WebBrowsableAttribute ();
Public Sub New ()

Examples

The following code example demonstrates how to use the WebBrowsableAttribute attribute to mark a property on a Web Parts control as available to be displayed in a PropertyGridEditorPart control. The property is set as browsable through the WebBrowsableAttribute constructor. This example is part of a larger example found in the PropertyGridEditorPart class overview.

[Personalizable(), WebBrowsable(), WebDisplayName("Job Type"), 
  WebDescription("Select the category that corresponds to your job.")]
public JobTypeName UserJobType
{
  get
  {
    object o = ViewState["UserJobType"];
    if (o != null)
      return (JobTypeName)o;
    else
      return _userJobType;
  }

  set { _userJobType = (JobTypeName)value; }
}
<Personalizable(), WebBrowsable(), WebDisplayName("Job Type"), _
  WebDescription("Select the category that corresponds to your job.")> _
Public Property UserJobType() As JobTypeName
  Get
    Dim o As Object = ViewState("UserJobType")
    If Not (o Is Nothing) Then
      Return CType(o, JobTypeName)
    Else
      Return _userJobType
    End If
  End Get
  Set(ByVal value As JobTypeName)
    _userJobType = CType(value, JobTypeName)
  End Set
End Property

Remarks

The WebBrowsableAttribute constructor is used when the WebBrowsable attribute is applied through the attribute declaration [WebBrowsable()] in C# or <WebBrowsable()> in Visual Basic.

Applies to

WebBrowsableAttribute(Boolean)

Initializes a new instance of the WebBrowsableAttribute class with the specified value for the Browsable property.

public:
 WebBrowsableAttribute(bool browsable);
public WebBrowsableAttribute (bool browsable);
new System.Web.UI.WebControls.WebParts.WebBrowsableAttribute : bool -> System.Web.UI.WebControls.WebParts.WebBrowsableAttribute
Public Sub New (browsable As Boolean)

Parameters

browsable
Boolean

A Boolean value indicating whether the property should be displayed in a PropertyGridEditorPart.

Remarks

The WebBrowsableAttribute constructor is used when the WebBrowsable attribute is applied through the attribute declaration with a Boolean value. To prevent a property from being displayed in a PropertyGridEditorPart control, the property could be marked with the attribute [WebBrowsable(false)] in C# or <WebBrowsable(false)> in Visual Basic.

Applies to