简体   繁体   English

Ajax组合框上的输入掩码

[英]Input mask on an Ajax combobox

I'm using ASP.Net 4.0 to create a web project, and I have two Ajax ComboBoxes on one of my pages. 我正在使用ASP.Net 4.0创建一个Web项目,我的一个页面上有两个Ajax ComboBox。 The users have requested input masks on the two ComboBoxes. 用户已在两个组合框上请求输入掩码。 I can't use the Ajax MaskedEditExtender, since it won't work with a ComboBox. 我不能使用Ajax MaskedEditExtender,因为它不能与ComboBox一起使用。 Has anyone ever implemented input masks on an Ajax ComboBox? 有没有人在Ajax ComboBox上实现输入掩码?

DevExpress editors allow you to use masks during editing. DevExpress编辑器允许您在编辑过程中使用遮罩。 Masks are useful when a string entered by an end-user should match a specific format. 当最终用户输入的字符串应与特定格式匹配时,掩码非常有用。 For instance, you may require a text editor to only accept date/time values in a 24-hour format, only accept numeric values, or only accept numbers that are automatically inserted into the placeholders of a telephone number. 例如,您可能要求文本编辑器仅接受24小时格式的日期/时间值,仅接受数字值或仅接受自动插入到电话号码占位符中的数字。

Masked input is supported by the following editor types: 以下编辑器类型支持屏蔽的输入:

Text box editors (ASPxTextBox and ASPxButtonEdit). 文本框编辑器(ASPxTextBox和ASPxButtonEdit)。 Text box mask settings can be accessed via the MaskSettings property. 文本框掩码设置可以通过MaskSettings属性访问。 The editor's mask can be specified via the MaskSettings.Mask property. 可以通过MaskSettings.Mask属性指定编辑器的蒙版。 Date editors (ASPxDateEdit). 日期编辑器(ASPxDateEdit)。 To enable masked input within a date editor, the UseMaskBehavior property should be set to true. 要在日期编辑器中启用屏蔽的输入,应将UseMaskBehavior属性设置为true。 The mask can be defined via the EditFormatString property if the EditFormat property is set to 'Custom'. 如果将EditFormat属性设置为“自定义”,则可以通过EditFormatString属性定义掩码。 In this demo, see how masked input behavior is implemented by entering data into the various types of editors. 在此演示中,了解如何通过将数据输入各种类型的编辑器来实现屏蔽的输入行为。

learn more here 在这里了解更多

using System;
using System.Web.UI;

public partial class Features_MaskedInput : Page {
  protected void Page_Load(object sender, EventArgs e) {
     txtZip.MaskSettings.PromptChar = cmbPromtChar.SelectedItem.Value.ToString()[0];
     dateEdit.EditFormatString = cmbDateType.SelectedItem.Value.ToString();
     dateEdit.Value = DateTime.Now;
   }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM