BaseValidator::ControlToValidate Property
Gets or sets the input control to validate.
Assembly: System.Web (in System.Web.dll)
[ThemeableAttribute(false)] [TypeConverterAttribute(typeof(ValidatedControlConverter))] public: property String^ ControlToValidate { String^ get (); void set (String^ value); }
<asp:BaseValidator ControlToValidate="String" />
Property Value
Type: System::StringThe input control to validate. The default value is String::Empty, which indicates that this property is not set.
Use the ControlToValidate property to specify the input control to validate. This property must be set to the ID of an input control for all validation controls except the CustomValidator control, which can be left blank. If you do not specify a valid input control, an exception will be thrown when the page is rendered. The ID must refer to a control within the same container as the validation control. It must be in the same page or user control, or it must be in the same template of a templated control.
The standard controls that can be validated are:
Note |
|---|
For an input control to be validated, the System.Web.UI::ValidationPropertyAttribute attribute must be applied to the control. |
All validation controls, except the RequiredFieldValidator control, will pass validation if the input control specified by the ControlToValidate property contains no text. If you are using a CustomValidator control, the client-side and server-side validation functions are not called either.
This property cannot be set by themes or style sheet themes. For more information, see ThemeableAttribute and ASP.NET Themes and Skins.
| Topic | Location |
|---|---|
| Walkthrough: Validating User Input in a Web Forms Page | Building ASP .NET Web Applications in Visual Studio |
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Note