Using FilteredTextBoxExtender


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.

Only math symbols (+,-,*,/,=,.) and numbers:

<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.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s