I am looking to use the Ajax MaskedEditControlExtender to create a masked input field for entry of a Zip Code. I have the masked part working fine but I can't seem to get the AutoComplete feature to work. My understanding is when I set AutoComplete to "true" and the AutoCompleteValue to "0" the extender should fill in any mask characters that the user did not fill with the "0".
When I tab out of the input element it simply leaves the characters that I typed and does not fill the remaining places with the zero "0"
Am I not understanding this feature correctly or am I not implementing this feature correctly?
Any insight would be truly appreciated.
Here is my html:
<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="Default.aspx.vb" Inherits="AjaxTest._Default" %>
<%@ 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>
<link href="MaskedEditStyles.css" rel="stylesheet" type="text/css" />
</head>
<body>
<form id="form1" runat="server">
<asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server" />
<div>
<asp:TextBox ID="txtZipCode" runat="server" Text = "" CssClass="MaskedEditDisplay" />
<asp:MaskedEditExtender ID="txtZipCodeExtender"
runat="server"
TargetControlID="txtZipCode"
AcceptNegative="None"
InputDirection="LeftToRight"
Mask="99999-9999"
OnFocusCssClass="MaskedEditFocus"
OnInvalidCssClass="MaskedEditError"
AutoComplete="true"
AutoCompleteValue="0"
/>
开发者_运维问答 <asp:MaskedEditValidator ID="MaskedEditValidator1"
runat="server"
ControlToValidate="txtZipCode"
ControlExtender="txtZipCodeExtender"
Display="Dynamic"
TooltipMessage="Enter a valid Zip Code"
IsValidEmpty="false"
EmptyValueMessage="Zip Code is Required"
InvalidValueMessage="Invalid Zip Code"
CssClass="MaskedEditMsg"
SetFocusOnError="true"
/>
</div>
</form>
</body>
</html>
精彩评论