views:

1110

answers:

3

I'm using a MaskedEditExtender to show users what format they should use to enter a date into a textbox. How do I change the mask to be dd/MM/yyyy instead of __/__/____?

A: 

Hai Kristian, Try this PromptCharacter="*" in your ajaxToolkit:MaskedEditExtender

Pandiya Chendur
Thanks, but this just replaces the underscores with asterisks. Is there another property I should be setting as well?
kristian
Yes kristian my answer was a stupid one just working for ur question and i ll let u know...
Pandiya Chendur
+2  A: 

I looked over the source code for the MaskedEditExtender, and it doesn't look it it supports what you want out of the box. You can replace the '_' with some other character with the PromptCharacter property, but to do what you want, you'd need to edit MaskedEditBehavior.js in the control's source code. Search for _PromptChar to find the relevant sections.

For a quick workaround, you could create an image of "dd mm yy" and use CSS to set it as the textbox's background image. Then the existing mask from the MaskedEditExtender will appear ontop of the image. Maybe use PromptCharacter=' ' (space) to make it look a little cleaner.

.dateTextBox{
background-image:url('images/my_hacky_dateformat_image.gif');
background-repeat:no-repeat;
padding-left:5px;
}
Morgan
+1  A: 

Hi! did you try the Watermark Extender? just a thought..

Cheers!

pabloide86