Monday, June 9, 2008

Ajax .Net V : FilteredTextBoxExtender and MaskTextEditor

My initial intention of this series of blogs in to give an overview of 40 odd newly added controls. Later on I will editing these blogs and add extra information about each controls.

FilteredTextBoxExtender can be used as an aid to user preventing them from entering invalid data. For example you can allow only numeric, lower case, upper case or certain characters to be enetered into a textbox.

Add an Ajax Web Form, so that ScriptManager will be present on the form. Other wise just add a ScriptManager to the form.

Add an Asp .Net TextBox meant for entering Age. Add a FilteredTextBoxExtender set its TargetControlId property to the TextBox Id. Set the FilterType property to Numbers.

Now it will allow only numeric input to the control.

As evident from the figure above you can set other filter types also.

Lets take up another another example similar to that demonstrated on
where the input expected to be arithmetic operators.

Set the FilterType to Custom and ValidChars property to +-/*.

Don't rely entirely on FilteredTextBoxExtender because on disabling JavaScript on browser the user can bypass the filter. So it should be used more as an aid to the user.


Land Phone
<asp:TextBox ID="txtLandPhone" runat="server"></asp:TextBox>
<asp:MaskedEditExtender ID="MaskedEditExtender1" runat="server"
Mask="9999-9999999" TargetControlID="txtLandPhone">

Related Blog

Ajax .Net I : Extension Controls in Visual Studio 2008

Ajax .Net II : Setting up Ajax Control Toolkit controls

Ajax .Net III : CalendarExtender Control

Ajax .Net IV : TextBoxWaterMarkExtender

Ajax .Net VI : ConfirmButtonExtender

Ajax ASP .Net VII : Accordion Control

No comments:

Post a Comment