ajaxToolkit 3.5sp1==>Calendar

ajaxToolkit中,Calendar的验证有Culture的问题,如果要用MM/dd/yyyy这种格式,参考下面的设置:

 

<%@ Page
    Language="C#"
    MasterPageFile="~/DefaultMaster.master"
    AutoEventWireup="true"
    Inherits="CommonPage"
    Culture="en-US"
    UICulture="en-US"
    Title="MaskedEdit Sample"
    Theme="SampleSiteTheme" %>
<%@ Register
    Assembly="AjaxControlToolkit"
    Namespace="AjaxControlToolkit"
    TagPrefix="ajaxToolkit" %>
<%@ Import Namespace="System.Threading" %>
<asp:Content ContentPlaceHolderID="SampleContent" runat="Server">
    <ajaxToolkit:ToolkitScriptManager runat="server" ID="ScriptManager1"  EnableScriptGlobalization="true" EnableScriptLocalization="true" />
    <div class="demoarea">
        <div class="demoheading">MaskedEdit Demonstration</div>

        <asp:TextBox ID="TextBox5" runat="server" Width="130px" style="text-align:justify" ValidationGroup="MKE" />
        <asp:ImageButton ID="ImgBntCalc" runat="server" ImageUrl="~/images/Calendar_scheduleHS.png" CausesValidation="False" />
        <ajaxToolkit:CalendarExtender ID="CalendarExtender1" PopupButtonID="ImgBntCalc" Enabled="True" runat="server" TargetControlID="TextBox5" Format="MM/dd/yyyy" />
        <ajaxToolkit:MaskedEditExtender ID="MaskedEditExtender5" runat="server"
            TargetControlID="TextBox5"
            Mask="99/99/9999"
            OnFocusCssClass="MaskedEditFocus"
            OnInvalidCssClass="MaskedEditError"
            MaskType="Date"

             CultureAMPMPlaceholder=""
 CultureCurrencySymbolPlaceholder="" CultureDateFormat=""
 CultureDatePlaceholder="" CultureDecimalPlaceholder=""
 CultureThousandsPlaceholder="" CultureTimePlaceholder=""
CultureName="en-US"/>
           
        <ajaxToolkit:MaskedEditValidator ID="MaskedEditValidator1" runat="server"
            ControlExtender="MaskedEditExtender5"
            ControlToValidate="TextBox5"
            EmptyValueMessage="Date is required"
            InvalidValueMessage="Date is invalid"
            Display="Dynamic"
            TooltipMessage="Input a date"
            EmptyValueBlurredText="*"
            InvalidValueBlurredMessage="*"
            ValidationExpression="^\d{2}/\d{2}/\d{4}$" IsValidEmpty="False"
            ValidationGroup="MKE"/>

你可能感兴趣的:(calendar)