CompareValidator using TextField with CalendarExtender with format dd/MM/yyyy HH:mm

Posted on 2008-10-29
Last Modified: 2008-12-09
Our project has a standard date format of dd/MM/yyyy HH:mm that I can not change.

I want to allow users to enter in a date into a textbox using the calendar extender.

Furthermore, we need to prevent them from selecting future dates.

Unfortunately the attached code does not work.

Suggestions / solutions?
  ErrorMessage="Can not pick future dates" 

Open in new window

Question by:Jonathan_Bride
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
LVL 22

Expert Comment

ID: 22841893
It is related to the current culture settings because the date format is determined by the culture information your application is using. You can change the culture information on a specific page by adding the culture information in the Page directive:
<%@ Page culture="here" %>
dd/MM/yyyy HH:mm looks like "en-GB", is it right? You can change try this:
<%@ Page culture="en-GB" %>

Author Comment

ID: 22845978

en-GB is unfortunately for me "31/10/2008 06:08:28". I need it without the last 28 / ss

LVL 22

Expert Comment

ID: 22850076
>>>en-GB is unfortunately for me "31/10/2008 06:08:28". I need it without the last 28 / ss

What do you get the value displayed? In the text box after user selects a date from the calendar?
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now


Author Comment

ID: 22852183
the display from user selection is (as per standard format)

dd/MM/yyyy HH:mm

Eng-Gb is

dd/MM/yyyyy HH:mm:ss

minor difference but it does not work as far as i am aware
LVL 22

Expert Comment

ID: 22852983
What if you set your CanlendarExtender's Format property to "dd/MM/yyyy HH:mm:ss", will that work for you?

Accepted Solution

Jonathan_Bride earned 0 total points
ID: 22863574
No, it can not have ":ss" at the end as the code behind in this solution automatically changes any date to dd/MM/yyyy HH:mm format

Found this regular expression that apparently I can use for custom validation

^(([0-2][1-9])|([1-3][0-1]))[\\.\\-\\/](([0][1-9])|([1][0-2]))[\\.\\-\\/](([2-3][0-9][0-9][0-9])) *(([0-9])|([0-1][0-9])|([2][0-3])):(([0-5][0-9]))$

If it does not, I will go with server side validation, instead of client-side.

Featured Post

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses the ASP.NET AJAX ModalPopupExtender control. In this article we will show how to use the ModalPopupExtender control, how to display/show/call the ASP.NET AJAX ModalPopupExtender control from javascript, how to show/display/cal…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question