Wednesday, August 7, 2013

Date Textbox User Control with MaskedEditExtender, MaskedEditValidator and CompareValidator

Code :

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:TextBox ID="TextBox1" runat="server" MaxLength="8" Visible="true"></asp:TextBox>
<asp:MaskedEditExtender ID="TextBox1_MaskedEditExtender" runat="server" CultureAMPMPlaceholder=""
    CultureCurrencySymbolPlaceholder="" ErrorTooltipEnabled="true" CultureDateFormat=""
    CultureDatePlaceholder="" CultureDecimalPlaceholder="" CultureThousandsPlaceholder=""
    CultureTimePlaceholder="" Enabled="True" InputDirection="RightToLeft" TargetControlID="TextBox1"
    ClearTextOnInvalid="True" Mask="99/99/9999" MaskType="Date" MessageValidatorTip="true">
    </asp:MaskedEditExtender>
<asp:MaskedEditValidator ID="MaskedEditValidator1" runat="server" ControlToValidate="TextBox1"
IsValidEmpty="false" ControlExtender="TextBox1_MaskedEditExtender" ToolTip="Enter Date Between 01/01/2000 to 01/01/2099"
EmptyValueMessage="Enter Date Value" InvalidValueBlurredMessage="Date is invalid"
    MinimumValue="01/01/2000" MaximumValue="01/01/2099" MaximumValueMessage="Date must be less than 01/01/2099"
    InvalidValueMessage="Invalid Format" MinimumValueMessage="Date must be greator than 01/01/2000">
    </asp:MaskedEditValidator>
<asp:CompareValidator ID="CompareValidator1" runat="server" ControlToValidate="TextBox1"
    ErrorMessage="Enter Correct Format" Operator="DataTypeCheck" Type="Date">
    </asp:CompareValidator>



No comments :

Post a Comment