WebDisplayNameAttribute Construtores

Definição

Inicializa uma nova instância da classe WebDisplayNameAttribute.Initializes a new instance of the WebDisplayNameAttribute class.

Sobrecargas

WebDisplayNameAttribute()

Inicializa uma nova instância da classe WebDisplayNameAttribute sem um nome especificado.Initializes a new instance of the WebDisplayNameAttribute class without a specified name.

WebDisplayNameAttribute(String)

Inicializa uma nova instância da classe WebDisplayNameAttribute com um nome de exibição especificado.Initializes a new instance of the WebDisplayNameAttribute class with a specified display name.

WebDisplayNameAttribute()

Inicializa uma nova instância da classe WebDisplayNameAttribute sem um nome especificado.Initializes a new instance of the WebDisplayNameAttribute class without a specified name.

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

Comentários

O WebDisplayNameAttribute construtor define a DisplayName propriedade como uma cadeia de caracteres vazia ("").The WebDisplayNameAttribute constructor sets the DisplayName property to an empty string ("").

Aplica-se a

WebDisplayNameAttribute(String)

Inicializa uma nova instância da classe WebDisplayNameAttribute com um nome de exibição especificado.Initializes a new instance of the WebDisplayNameAttribute class with a specified display name.

public:
 WebDisplayNameAttribute(System::String ^ displayName);
public WebDisplayNameAttribute (string displayName);
new System.Web.UI.WebControls.WebParts.WebDisplayNameAttribute : string -> System.Web.UI.WebControls.WebParts.WebDisplayNameAttribute
Public Sub New (displayName As String)

Parâmetros

displayName
String

O nome amigável a ser usado em uma PropertyGridEditorPart.The friendly name to use in a PropertyGridEditorPart.

Exemplos

O exemplo de código a seguir demonstra como usar o WebDisplayNameAttribute atributo para atribuir um nome de exibição a uma propriedade em um controle de Web Parts.The following code example demonstrates how to use the WebDisplayNameAttribute attribute to assign a display name to a property on a Web Parts control. A UserJobType propriedade personalizada recebe o nome amigável "tipo de trabalho" para exibir no PropertyGridEditorPart controle.The custom UserJobType property is given the friendly name "Job Type" to display in the PropertyGridEditorPart control. O nome é atribuído por meio do WebDisplayNameAttribute Construtor.The name is assigned through the WebDisplayNameAttribute constructor. Este exemplo é parte de um exemplo maior encontrado na PropertyGridEditorPart visão geral da classe.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

Comentários

O WebDisplayNameAttribute construtor define a DisplayName propriedade como displayName .The WebDisplayNameAttribute constructor sets the DisplayName property to displayName. O displayName parâmetro é o valor que será exibido em um PropertyGridEditorPart controle.The displayName parameter is the value that will appear in a PropertyGridEditorPart control.

Aplica-se a