Add Validator (ASP.NET)

Adds a selected Validator to the active input control (the control containing the caret).

Purpose

Add Validator makes it much easier to create validators associated with a specific input control. It automatically constructs proper validator syntax, binds the created validator to the source control and navigates you through attributes you are likely to specify.

Availability

Available from the context menus or via shortcuts:

  • when the caret is within or before a tag that represents a server input control.

Notes

  • Refactor! context menu allows you to choose among five available Validator types: CompareValidator, CustomValidator, RangeValidator, RegularExpressionValidator and RequiredFieldValidator. Please refer to the corresponding class descriptions for details on features provided by these validator types.
  • Add Validator creates text fields so you can easily navigate between validator attributes and change their values.

Example

<asp:TextBox ID="TextBox1" runat="server">my text</asp:TextBox>

Result:

<asp:TextBox ID="TextBox1" runat="server">my text</asp:TextBox>
<asp:CompareValidator ID="CompareValidator1" ControlToValidate="TextBox1" 
ControlToCompare="TextBox1" ErrorMessage="CompareValidator" runat="server" />

Screenshot

rsAddValidator