Ajax Control Toolkit
FilteredTextBox Demonstration
Only digits are allowed here:
Only lower-case letters are allowed here:
Only math symbols (+,-,*,/,=,.) and numbers:
No digits allowed in this textbox:
FilteredTextBox Description

FilteredTextBox is an extender which prevents a user from entering invalid characters into a text box. Note that since this effect can be avoided by deactivating JavaScript, you should use this extender as a convenience for your users, but you must never expect that the data being sent to the server consists of "valid" chars only.

FilteredTextBox Properties

The math-symbols example above is initialized with this code:

<ajaxToolkit:FilteredTextBoxExtender ID="ftbe" runat="server"
    TargetControlID="TextBox3"         
    FilterType="Custom, Numbers"
    ValidChars="+-=/*()." />
  • TargetControlID - The ID of the text box for this extender to operate on
  • FilterType - A the type of filter to apply, as a comma-separated combination of Numbers, LowercaseLetters, UppercaseLetters, and Custom. If Custom is specified, the ValidChars field will be used in addition to other settings such as Numbers.
  • FilterMode - A the filter mode to apply, either ValidChars (default) or InvalidChars. If set to InvalidChars, FilterType must be set to Custom; if set to ValidChars, FilterType must contain Custom.
  • ValidChars - A string consisting of all characters considered valid for the text field, if "Custom" is specified as the filter type. Otherwise this parameter is ignored.
  • InvalidChars - A string consisting of all characters considered invalid for the text field, if "Custom" is specified as the filter type and "InvalidChars" as the filter mode. Otherwise this parameter is ignored.
  • FilterInterval - An integer containing the interval (in milliseconds) in which the field's contents are filtered, defaults to 250.
Copyright © 2006-2013 Microsoft Corporation. All Rights Reserved.