FilteredTextBoxExtender控件的主要属性
(1) TargetControlID: 要过滤掉控件ID
(2)FilterType: 过滤的格式,包括Number,Custom,LowercaseLetters, UppercaseLetters(可指定多项如:Custrom,Number)
(3)FilterMode:过滤的模式,有InvalidChars和ValidChars(默认)
(4)InvalidChars:不合法的字符。FilterType要有Custom,FilterMode为InvaildChars
(5)ValidChars:合法的字符。FilterType要有Custom,FilterMode为VaildChars
示例代码
1.只允许数字
<ajaxToolkit:FilteredTextBoxExtender runat="server" TargetControlID="txtbox" ID="ftbe" FilterType="Numbers" > </ajaxToolkit:FilteredTextBoxExtender>
2.只允许数字和指定的字符
<ajaxToolkit:FilteredTextBoxExtender runat="server" TargetControlID="txtbox" ID="ftbe" FilterType="Numbers,Custom" FilterMode="ValidChars"
ValidChars="abc"> </ajaxToolkit:FilteredTextBoxExtender>
3.指定不允许的字符
<ajaxToolkit:FilteredTextBoxExtender runat="server" TargetControlID="txtbox" ID="ftbe" FilterType="Custom" FilterMode="InValidChars"
InvalidChars="abc"> </ajaxToolkit:FilteredTextBoxExtender>