MaskedEdit 是一个扩展控件,它可以让文本控件 ( 如: TextBox ) 拥有 屏蔽编辑 功能。它的使用相当简单。
同时和它一起配合的使用的还有一个验证控件 MaskedEditValidator
TextBox
的例子
<
asp
:
TextBox
ID ="TextBox2" runat ="server" Width ="130px" Height ="16px" ValidationGroup ="MKE" />
<
ajaxToolkit
:
MaskedEditExtender
ID ="MaskedEditExtender2" runat ="server"
TargetControlID ="TextBox2"
Mask ="9,999,999.99"
MessageValidatorTip ="true"
OnFocusCssClass ="MaskedEditFocus"
OnInvalidCssClass ="MaskedEditError"
MaskType ="Number"
InputDirection ="RightToLeft"
AcceptNegative ="Left"
DisplayMoney ="Left"
ErrorTooltipEnabled ="True" />
<
ajaxToolkit
:
MaskedEditValidator
ID ="MaskedEditValidator2" runat ="server"
ControlExtender ="MaskedEditExtender2"
ControlToValidate ="TextBox2"
IsValidEmpty ="False"
MaximumValue ="12000"
EmptyValueMessage ="Number is required"
InvalidValueMessage ="Number is invalid"
MaximumValueMessage ="Number > 12000"
MinimumValueMessage ="Number < -100"
MinimumValue ="-100"
Display ="Dynamic"
TooltipMessage ="Input a number from -100 to 12000"
EmptyValueBlurredText ="*"
InvalidValueBlurredMessage ="*"
MaximumValueBlurredMessage ="*"
MinimumValueBlurredText ="*"
ValidationGroup ="MKE" />