AjaxControlToolkit MaskedEditExtender - custom mask appearance

对着背影说爱祢 提交于 2019-12-07 09:58:34

问题


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


回答1:


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:


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

Cheers!




回答3:


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



来源:https://stackoverflow.com/questions/1837200/ajaxcontroltoolkit-maskededitextender-custom-mask-appearance

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!