AjaxControlToolkit MaskedEditExtender - custom mask appearance

4.1k Views Asked by At

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 __/__/____?

3

There are 3 best solutions below

0
Morgan On BEST ANSWER

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;
}
2
ACP On

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

0
pabloide86 On

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

Cheers!