Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7782453
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T19:32:57+00:00 2026-06-01T19:32:57+00:00

I am trying to validate if the date is valid meaning that its not

  • 0

I am trying to validate if the date is valid meaning that its not in the future and also make sure its a legit date i.e 03/32/2012 is not valid. What I currently have works only to verify if the date is valid but it does not work when I place the date in future. Also I am having a problem if someone enters a date like 03/32/2012 it will say that its not valid but they can still click save button and then the exception will occur. What is the best way to approach this.

Here is my code:

<asp:TextBox ID="tbDate" runat="server" Text=""></asp:TextBox>
<asp:Image ID="imgCalendar" runat="server" ImageUrl="~/App_Themes/Sugar2006/images/Calendar_scheduleHS.png" ImageAlign="Middle" />
<asp:CalendarExtender ID="ce" runat="server" TargetControlID ="tbDate" PopupButtonID="imgCalendar" />        
<asp:MaskedEditExtender ID="mex" runat="server" 
                        TargetControlID="tbDate" 
                        Mask="99/99/9999" 
                        MaskType="Date"
                        MessageValidatorTip="true"
                        OnFocusCssClass="MaskedEditFocus"
                        OnInvalidCssClass="MaskedEditError" />
<asp:MaskedEditValidator ID="mev" runat="server" 
                        ControlToValidate="tbDate"
                        ControlExtender="mex" 
                        Display="Dynamic" 
                        InvalidValueMessage="This date is invalid!" Font-Bold="True" 
                        ForeColor="#D50000" />
<asp:RequiredFieldValidator runat="server" ID="DReq"
                        ControlToValidate="tbDate"
                        Display="None"
                        ErrorMessage="A Date is required." ValidationGroup="vgMyGroup"/>
<asp:ValidatorCalloutExtender runat="Server" ID="DReqE"
                        TargetControlID="DReq"
                        HighlightCssClass="validatorCalloutHighlight" />
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T19:32:59+00:00Added an answer on June 1, 2026 at 7:32 pm

    I have set the ValidationGroup on the MaskedEditValidator and that fixed my issue. Also to fix to not allow future dates I have done the following inside the .cs file. All my issues have been resolved. Thanks. 🙂

        protected void mev_Init(object sender, EventArgs e) {
            ((MaskedEditValidator)sender).MaximumValue = DateTime.Now.ToString("MM/dd/yyyy");
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to make a validation that will validate that the entered date
I am trying to validate a text field for valid date (MM/DD/YYYY) I have
I'm trying to write a method that checks whether a date is valid. It
I'm trying to validate date using PHP. I'd like following formats to be valid:
I was trying to define a function to validate date entered in dd/mm/yyyy format.
I'm trying to write a custom method to validate a date. The date however
I have an application and I'm trying to make sure it's running in a
I'm very new in regular expression and I'm trying to validate date using following
I am trying to validate following date format through regExp , but still i
i am trying this code to validate a date but i get false. what

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.