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.

C#
public WebBrowsableAttribute();

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.

C#
[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; }
}

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

.NET Framework 4.8.1 and other versions
Product Versions
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

WebBrowsableAttribute(Boolean)

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

C#
public WebBrowsableAttribute(bool browsable);

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

.NET Framework 4.8.1 and other versions
Product Versions
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1