Introduction:
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.
When Ever You Want to Use Ajax Controls in your website First you need Add.
AjaxControlToolkit reference to your application.
<%@ Register
Assembly="AjaxControlToolkit"
Namespace="AjaxControlToolkit"
TagPrefix="asp"
%>
You can Change TagPrefix Also,Some Exaples tagPrefix="ajax", tagPrefix="cc1",tagPrefix="asp"
And also you have to add Tool kit Scriptmanager Control under <Form> tag:
<asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
</asp:ToolkitScriptManager>
Your aspx page:
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.
When Ever You Want to Use Ajax Controls in your website First you need Add.
AjaxControlToolkit reference to your application.
<%@ Register
Assembly="AjaxControlToolkit"
Namespace="AjaxControlToolkit"
TagPrefix="asp"
%>
You can Change TagPrefix Also,Some Exaples tagPrefix="ajax", tagPrefix="cc1",tagPrefix="asp"
And also you have to add Tool kit Scriptmanager Control under <Form> tag:
<asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
</asp:ToolkitScriptManager>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<asp:ToolkitScriptManager
ID="ToolkitScriptManager1"
runat="server">
</asp:ToolkitScriptManager>
<div>
<table>
<tr>
<td>
Numbers only:
</td>
<td>
<asp:TextBox ID="txtPhoneNumber"
runat="server"></asp:TextBox>
<asp:FilteredTextBoxExtender
ID="FilteredTextBoxExtender1"
runat="server"
TargetControlID="txtPhoneNumber"
FilterType="Numbers">
</asp:FilteredTextBoxExtender>
</td>
</tr>
<tr>
<td>
Lowercase Letters only:
</td>
<td>
<asp:TextBox ID="txtNameLower"
runat="server"></asp:TextBox>
<asp:FilteredTextBoxExtender
ID="FilteredTextBoxExtender2"
runat="server"
TargetControlID="txtNameLower"
FilterType="LowercaseLetters">
</asp:FilteredTextBoxExtender>
</td>
</tr>
<tr>
<td>
Uppercase Letters only:
</td>
<td>
<asp:TextBox ID="txtUpper"
runat="server"></asp:TextBox>
<asp:FilteredTextBoxExtender
ID="FilteredTextBoxExtender5"
runat="server"
TargetControlID="txtUpper"
FilterType="UppercaseLetters">
</asp:FilteredTextBoxExtender>
</td>
</tr>
<tr>
<td>
Numbers and Symbols:
</td>
<td>
<asp:TextBox ID="txtCustom"
runat="server"></asp:TextBox>
<asp:FilteredTextBoxExtender
ID="FilteredTextBoxExtender4"
runat="server"
TargetControlID="txtCustom"
FilterType="Custom,NumbersS"
ValidChars="+-=/*().">
</asp:FilteredTextBoxExtender>
</td>
</tr>
</table>
</div>
</form>
</body>
</html>
|