Hi
Validation User input is very important in the Web. Although
ASP.NET has a rich set of validation control we some time want to prevent a
user from entering any invalid characters.
Lest say, we have a textbox control where the user needs to
enter the number of products he will buy. We can always validate the value that
he enters in the text box but the best thing would be if we do not allow him to
enter any thing other that numeric value in the textbox.
We have a new extender in the ATLAS toolbox for such requirement (FilteredTextBoxExtender).
The code to use the FilteredTextBoxExtender looks like this.
<atlasToolkit:FilteredTextBoxExtender ID="ftbe" runat="server">
<atlasToolkit:FilteredTextBoxProperties
TargetControlID="TextBox3"
FilterType="Custom, Numbers"
ValidChars="+-=/*()." />
</atlasToolkit:FilteredTextBoxExtender>
Here the TargetControlID is the Id of the button control, which will
cause the alert message. FilterType is the type of filter to be applied. This can be
a comma-separated list. The values are (Numbers, LowercaseLetters,
UppercaseLetters, and Custom). If custom is specified the valid chars
field will also be used for other settings. ValidChars is the list of
character valid for the field. The field is only used if the custom is
specified in the filter type property.
This way we can validate user form entering any wrong data
to the field. But remember disabling the JavaScript can disable this effect so
you should use this extender as a convenience to the user but still have
validation for the data
Hope this helps
Thanks
Vikram