# Tuesday, 22 December 2009
« Testing ASP.Net MVC routes with MVC Cont... | Main | Using jQuery to access text with a custo... »

I made a small upgrade to an application that had a text box for date input to use the masked edit and calendar extender found in the asp.net control toolkit.  The two extenders are great together for allowing a user to select a date off the calendar or type it in without having to worry about the formatting.  The masked edit even has a nice auto complete feature that allows you to type the month and day without the year and the extender will add the year for you (if you want the current year of course).

Everything works well except for one small bug or feature when using these two extenders together.  If you set up your mask to be ''99/99/9999" but leave the calendar’s format to it’s default then on post backs with dates having one digit month or days the calendar control will reappear. 

In order to correct this, you have to set the format for the calendar to match your mask.  In the example above you would need to set the format to "MM/dd/yyyy" for the calendar extender.

Hopefully, someone will find this post before spending too long trying to figure out what is happening (like I did).


Please login with either your OpenID above, or your details below.
(will show your gravatar icon)
Home page

Comment (Some html is allowed: b, blockquote@cite, em, i, strike) where the @ means "attribute." For example, you can use <a href="" title=""> or <blockquote cite="Scott">.  

[Captcha]Enter the code shown (prevents robots):

Live Comment Preview