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.
<%@ Page Language="C#" AutoEventWireup="true" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit"
TagPrefix="cc1"
%>
<!DOCTYPE html
PUBLIC "-//W3C//DTD
XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
protected
void Button1_Click(object
sender, EventArgs e)
{
Label1.Text = "Your ZIP Code: " +
TextBox1.Text;
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title>Ajax
FilteredTextBoxExtender - How to use FilteredTextBoxExtender in asp.net
ajax</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<h2 style="color: DarkBlue; font-style:
italic;">
Ajax Control Toolkit Example:
Using FilteredTextBoxExtender</h2>
<hr width="600" align="left" color="CornFlowerBlue" />
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<cc1:FilteredTextBoxExtender ID="FilteredTextBoxExtender1" runat="server"
TargetControlID="TextBox1"
FilterType="Numbers" FilterMode="ValidChars">
</cc1:FilteredTextBoxExtender>
<br />
<asp:Label ID="Label1" runat="server" ForeColor="OrangeRed" Font-Size="X-Large" Height="75">
</asp:Label>
<br />
<asp:Label ID="Label2" runat="server" ForeColor="DodgerBlue" Font-Italic="true" Font-Names="Comic Sans MS"
Font-Size="Large" Text="Zip Code " Font-Underline="true">
</asp:Label>
<asp:TextBox ID="TextBox1" runat="server" Font-Bold="true" BackColor="Snow" ForeColor="DeepPink"
Font-Names="Comic Sans MS" Font-Size="Medium">
</asp:TextBox>
<br />
<br />
<asp:Button ID="Button1" runat="server" ForeColor="DodgerBlue" Font-Bold="true" Height="40"
OnClick="Button1_Click" Text="Submit ZIP Code" />
</div>
</form>
</body>
</html>
|
0 comments :
Post a Comment