ValidationPropertyAttribute.Name 屬性

定義

取得 ASP.NET 伺服器控制項的驗證屬性之名稱。

public:
 property System::String ^ Name { System::String ^ get(); };
public string Name { get; }
member this.Name : string
Public ReadOnly Property Name As String

屬性值

String

驗證屬性的名稱。

範例

下列程式碼範例示範在建立自訂控制項時使用 ValidationPropertyAttribute 類別。

[ValidationPropertyAttribute("Message")]
public class MessageControl : Label
{
   private int _message = 0;
   public int Message
   {
      get 
      {
         return _message;
      }
      set
      {
         _message = value;
      }
   }
}
<ValidationPropertyAttribute("Message")> Public Class MessageControl
   Inherits Label
   Private _message As Integer = 0

   Public Property Message() As Integer
      Get
         Return _message
      End Get
      Set(ByVal Value As Integer)
         _message = Value
      End Set
   End Property
End Class

適用於