ajaxtoolkit maskededitextender不工作

时间:2011-08-30 05:01:30

标签: c# asp.net ajax

我正在使用visual studio 2008并使用本教程:

http://www.asp.net/ajax/videos/how-do-i-use-the-aspnet-ajax-maskededit-controls

当我运行Web应用程序时,没有错误,但屏蔽不起作用,似乎也没有样式化。

这是我的代码:

   <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit"%>
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Untitled Page</title>
    <link href="StyleSheet.css" rel="stylesheet" type="text/css" />
</head>

<body>
    <form id="form1" runat="server">
        <asp:ScriptManager ID="ScriptManager1" runat="server" />
        <div>
         <br /><br />
        Enter a Date in the format 99/99/9999 (culture sensitive) <br />
            <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
            <ajaxToolkit:MaskedEditExtender ID="MaskedEditExtender1"
                runat="server"
                TargetControlID="TextBox1"
                Mask="99/99/9999"
                MaskType=Date
                MessageValidatorTip=true
                OnFocusCssClass="MaskedEditFocus"
                OnInvalidCssClass="MaskedEditError" />
            <ajaxToolkit:MaskedEditValidator ID="MaskedEditValidator1"
                runat="server"
                ControlToValidate="TextBox1"
                ControlExtender="MaskedEditExtender1"
                Display=Dynamic
                TooltipMessage="PLease enter a date"
                IsValidEmpty=false
                EmptyValueMessage="A Date is Required"
                InvalidValueMessage="Ths date is invalid" />  
                <br /><br />
        Enter a Number in the format $99,999.00 <br />
            <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
            <ajaxToolkit:MaskedEditExtender ID="MaskedEditExtender2"
                runat="server"
                TargetControlID="TextBox2"
                Mask="99,999.99"
                MaskType=Number
                MessageValidatorTip=true
                OnFocusCssClass="MaskedEditFocus"
                OnInvalidCssClass="MaskedEditError"
                InputDirection=RightToLeft
                DisplayMoney=Left
                AcceptNegative=Left />
            <ajaxToolkit:MaskedEditValidator ID="MaskedEditValidator2"
                runat="server"
                ControlToValidate="TextBox2"
                ControlExtender="MaskedEditExtender2"
                Display=Dynamic
                TooltipMessage="Please enter a value between -100 and 12000"
                IsValidEmpty=false
                EmptyValueMessage="A Number is Required"
                InvalidValueMessage="This Number is invalid"
                MinimumValue="-100"
                MinimumValueMessage="The value is too small." MaximumValue="12000"
                MaximumValueMessage="The number is too large" />  
                <br /><br />    
        Enter a Time in the Format 99:99:99 (type A or P for AM and PM)<br />
            <asp:TextBox ID="TextBox3" runat="server"></asp:TextBox>
            <ajaxToolkit:MaskedEditExtender ID="MaskedEditExtender3"
                runat="server"
                TargetControlID="TextBox3"
                Mask="99:99:99"
                MaskType=Time
                MessageValidatorTip=true
                OnFocusCssClass="MaskedEditFocus"
                OnInvalidCssClass="MaskedEditError"
                AcceptAMPM=true />
            <ajaxToolkit:MaskedEditValidator ID="MaskedEditValidator3"
                runat="server"
                ControlToValidate="TextBox3"
                ControlExtender="MaskedEditExtender3"
                Display=Dynamic
                TooltipMessage="Please Enter a Time"
                IsValidEmpty=false
                EmptyValueMessage="A Time is Required"
                InvalidValueMessage="This Time is invalid" />
                <br /><br />     
        </div>
    </form>   
</body>
</html>

DLL和PDB都在bin文件夹中,我有工具箱

我在做错了吗?

1 个答案:

答案 0 :(得分:0)

我不知道您的示例代码是否是原创代码,但我看到过像这样的评论部分......

<!--
    some comment with code fragments
-->

...导致评论后MaskedEditExtender失败。在将其发布到此处之前,您可能已经从示例中删除了评论。

删除脚本区域中的注释,然后查看它是否有效。