altas(ajax)控件(十二):FilteredTextBox

FilteredTextBox控件是一个非常有用的控件,使用他能直接过滤一些字符。
例子:
一:只允许数字
< asp:TextBox  ID ="TextBox1"  runat ="server"   />
< ajaxToolkit:FilteredTextBoxExtender
           
ID ="FilteredTextBoxExtender1"
           runat
="server"
           TargetControlID
="TextBox1"
           FilterType
="Numbers"   />
 
二:只允许输入小字字母
< asp:TextBox  ID ="TextBox2"  runat ="server"   />
< ajaxToolkit:FilteredTextBoxExtender
            
ID ="FilteredTextBoxExtender2"
            runat
="server"  
            TargetControlID
="TextBox2"
            FilterType
="LowercaseLetters"   />
三:只允许输入(+,-,*,/,=,.)和数字
< asp:TextBox  ID ="TextBox3"  runat ="server"   /></ td >
< ajaxToolkit:FilteredTextBoxExtender
            
ID ="FilteredTextBoxExtender3"
            runat
="server"  
            TargetControlID
="TextBox3"
            FilterType
="Custom, Numbers"
            ValidChars
="+-=/*()."   />
四:不允许输入数字
< asp:TextBox  ID ="TextBox4"  runat ="server"   />
< ajaxToolkit:FilteredTextBoxExtender
            
ID ="FilteredTextBoxExtender4"
            runat
="server"  
            TargetControlID
="TextBox4"
            FilterType
="Custom"
            FilterMode
="InvalidChars"
            InvalidChars
="1234567890"   />
 
属性
说明
TargetControlID
需要过滤的控件的ID
FilterType
过滤的格式:有Numbers, LowercaseLetters, UppercaseLetters, and Custom四种格式
FilterMode
过滤模式:有ValidChars (默认) or InvalidChars两种。
ValidChars
合法的字符。当设置该值时,需要FilterType包含有Custom
InvalidChars
不合法的字符:当设置该值时,需要FilterType必须是Custom
 

你可能感兴趣的:(filter)