Search

Friday, May 30, 2014
0 comments

How to Use Filtered TextBox Extender of AJAX in ASP.NET

5:55 AMFriday, May 30, 2014
FilteredTextBoxExtender enables you to apply filtering to a text box control that prevents certain characters from being inserted in the text box. For example, you can limit a text box to either enter only characters, or digit, or dates. This extender is different from ASP.NET validation controls as it prevents the users from entering invalid characters.

Lets take an simple example

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default3.aspx.cs" Inherits="Default3" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <div>
    Enter Number only:
        <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
        <asp:Button ID="Button1" runat="server" Text="Button" />
        <asp:FilteredTextBoxExtender ID="FilteredTextBoxExtender1" runat="server" TargetControlID ="TextBox1" FilterType="Numbers">
        </asp:FilteredTextBoxExtender>
    </div>
    </form>
</body>
</html>

Code Generate the following Output

How to Use Filtered TextBox Extender of AJAX in ASP.NET

For Lower case Letter Only Set 
FilterType="LowercaseLetters"
For Upper Case Letter only
FilterType="UppercaseLetters"
For Upper and Number
FilterType="UppercaseLetters,Numbers"
Protected by Copyscape Online Copyright Protection Software

0 comments :

Post a Comment

 
Toggle Footer
Top