AjaxControlToolkit MaskedEditExtender-自定义蒙版外观 [英] AjaxControlToolkit MaskedEditExtender - custom mask appearance

查看:95
本文介绍了AjaxControlToolkit MaskedEditExtender-自定义蒙版外观的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用MaskedEditExtender向用户展示他们应使用哪种格式在文本框中输入日期。如何将掩码更改为 dd / MM / yyyy 而不是 __ / __ / ____

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

推荐答案

我查看了MaskedEditExtender的源代码,它看起来并不支持您想要的功能。您可以使用PromptCharacter属性将 _替换为其他字符,但是要执行所需的操作,您需要在控件的源代码中编辑MaskedEditBehavior.js。搜索 _PromptChar 以找到相关部分。

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.

要快速解决此问题,您可以创建一个图像 dd mm yy,然后使用CSS将其设置为文本框的背景图片。然后,来自MaskedEditExtender的现有遮罩将出现在图像的顶部。也许使用PromptCharacter =''(空格)使其看起来更整洁。

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;
}

这篇关于AjaxControlToolkit MaskedEditExtender-自定义蒙版外观的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆