AjaxControlToolkit MaskedEditExtender - 自定义蒙版外观

发布于 2024-08-13 10:03:33 字数 113 浏览 2 评论 0原文

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

肩上的翅膀 2024-08-20 10:03:33

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

为了快速解决问题,您可以创建“dd mm yy”的图像并使用 CSS 将其设置为文本框的背景图像。然后,MaskedEditExtender 中的现有蒙版将出现在图像顶部。也许使用 PromptCharacter=' ' (空格)使其看起来更干净一些。

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

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;
}
七秒鱼° 2024-08-20 10:03:33

您尝试过水印扩展器吗?只是一个想法..

干杯!

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

Cheers!

愛放△進行李 2024-08-20 10:03:33

海·克里斯蒂安,
在 ajaxToolkit:MaskedEditExtender 中尝试这个 PromptCharacter="*"

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文