Home / AJAX

Ajax Control Toolkit FilteredTextBox

RSS
Modified on 2010/04/16 00:26 by Stephen Walther Categorized as Uncategorized
FilteredTextBox is an extender that lets users enter only characters that you define into a text box or that prevents users from entering characters that you specify.

Note: Because the extender relies on JavaScript, you should never assume that the data being sent to the server consists of only the characters you allow. Always perform a server-side validation check on data sent from the client.

FilteredTextbox Server Reference

The properties in italics are optional.

<ajaxToolkit:FilteredTextBoxExtender ID="ftbe" runat="server"
    TargetControlID="TextBox3"         
    FilterType="Custom, Numbers"
    ValidChars="+-=/*()." />

  • TargetControlID - The ID of the control to extend.
  • FilterType - The type of filter to apply, specified as a comma-separated combination of the following values: Numbers, LowercaseLetters, UppercaseLetters, and Custom. If Custom is specified, the ValidChars property will be used in addition to other settings, such as Numbers.
  • FilterMode - The filter mode to apply. Supported values are ValidChars and InvalidChars. If the property is set to InvalidChars, FilterType must be set to Custom. If the property is set to ValidChars, FilterType must be set to Custom.
  • ValidChars - A string that consists of all characters that are considered valid for the text box when the field type is Custom. If the field type is not Custom, this property value is ignored.
  • InvalidChars - A string that consists of all characters that are considered invalid for the text box when the field type is Custom. If the field type is not Custom, this property value is ignored.
  • FilterInterval - An integer that specifies the interval, in milliseconds, in which the field's contents are filtered. The default is 250.

FilteredTextbox Client Reference

Sys.Extended.UI.FilteredTextBoxBehavior Class

  • Summary - Adds behavior to a text box that lets users enter only characters that you define or that prevents users from entering characters that you specify.
  • Parameters - Sys.UI.DomElement element

Events

  • processKey(handler) - Adds or removes an event handler for the processKey event.
    • Parameters - A function that represents the event handler.
  • filtered(handler) - Adds or removes an event handler for the filtered event.
    • Parameters - A function that represents the event handler.

Methods

  • initialize() - Initializes the FilteredTextBox behavior.
  • dipose() - Disposes the FilteredTextBox behavior.
  • raiseProcessKey(eventArgs) - Raises the processKey event.
    • Parameters - Sys.Extended.UI.FilteredTextBoxProcessKeyEventArgs eventArgs
  • raiseFiltered(eventArgs) - Raises the filtered event.
    • Parameters - Sys.Extended.UI.FilteredTextBoxEventArgs eventArgs

Properties

  • ValidChars - Gets or sets a string that consists of all characters that are considered valid for the text box when the field type is Custom.
    • Remarks - If the field type is not Custom, this property value is ignored.
  • InvalidChars - Gets or sets a string that consists of all characters that are considered invalid for the text box when the field type is Custom.
    • Remarks - If the field type is not Custom, this property value is ignored.
  • FilterType - Gets or sets a Sys.Extended.UI.FilterTypes object to apply to the FilterTextBox instance.
    • Remarks - The type of filter to apply can be a comma-separated combination of the following values: Numbers, LowercaseLetters, UppercaseLetters, and Custom. If Custom is specified, the ValidChars property will be used in addition to other settings, such as Numbers.
  • FilterMode - Gets or sets a Sys.Extended.UI.FilterModes object that specifies the mode to apply to the FilterTextBox instance.
    • Remarks - Supported values are ValidChars and InvalidChars.
  • FilterInterval - Gets or sets the interval, in milliseconds, in which the field's contents are filtered.

Sys.Extended.UI.HorizontalSide Enum

  • Summary - Defines the character filter to apply to a text box.
  • Custom : 0x1
  • Numbers : 0x2
  • UppercaseLetters : 0x4
  • LowercaseLetters : 0x8

Sys.Extended.UI.FilterModes Enum

  • Summary - Defines the filter mode to apply to a text box.
  • ValidChars : 0x1
  • InvalidChars : 0x2

Sys.Extended.UI.FilteredTextBoxProcessKeyEventArgs Class

  • Summary - Defines arguments for the processKey event.
  • Parameters - String key, String text, Boolean shouldFilter

Properties

  • key - Gets a string that contains the key to be processed.
  • text - Gets the current text in the text box.
  • shouldFilter - Gets a Boolean value that specifies whether the character should be filtered based on the current FilteredTextBox settings.
  • allowKey - Gets or sets a Boolean value that specifies whether the key will be filtered. This property defaults to the opposite of shouldFilter and should be set in a handler for the processKey event.

Sys.Extended.UI.FilteredTextBoxEventArgs Class

  • Summary - Defines arguments for the filtered event.
  • Parameters - String key

Properties

  • key - Gets a string that contains the key that was filtered.