Export (0) Print
Expand All

ValidationPropertyAttribute Class

Defines the metadata attribute that ASP.NET server controls use to identify a validation property. This class cannot be inherited.

For a list of all members of this type, see ValidationPropertyAttribute Members.

System.Object
   System.Attribute
      System.Web.UI.ValidationPropertyAttribute

[Visual Basic]
<AttributeUsage(AttributeTargets.Class)>
NotInheritable Public Class ValidationPropertyAttribute
   Inherits Attribute
[C#]
[AttributeUsage(AttributeTargets.Class)]
public sealed class ValidationPropertyAttribute : Attribute
[C++]
[AttributeUsage(AttributeTargets::Class)]
public __gc __sealed class ValidationPropertyAttribute : public
   Attribute
[JScript]
public
   AttributeUsage(AttributeTargets.Class)
class ValidationPropertyAttribute extends Attribute

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Remarks

This attribute is typically used for form-based input controls.

For more information about attributes, see Extending Metadata Using Attributes.

Example

[Visual Basic, C#, C++] The following example demonstrates using the ValidationPropertyAttribute class when creating a custom control.

[Visual Basic] 
<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 

[C#] 
[ValidationPropertyAttribute("Message")]
public class MessageControl : Label
{
   private int _message = 0;
   public int Message
   {
      get 
      {
         return _message;
      }
      set
      {
         _message = value;
      }
   }
   
}

[C++] 
[ValidationPropertyAttribute(S"Message")]
public __gc class MessageControl : public Label
{
private:
   int _message;
public:
   __property int get_Message() 
   {
      return _message;
   }
   __property void set_Message( int value )
   {
      _message = value;
   }
};

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.

Requirements

Namespace: System.Web.UI

Platforms: Windows 2000, Windows XP Professional, Windows Server 2003 family

Assembly: System.Web (in System.Web.dll)

See Also

ValidationPropertyAttribute Members | System.Web.UI Namespace | Attribute | IValidator | BaseValidator

Show:
© 2014 Microsoft