FilterTextBoxExtender
TargetControlID - 要執行文本過濾的TextBox ID
FilterType - 過濾類型,Numbers,LowercaseLetters(小寫),UpcaseLettes(大寫)and Custom(default)
FilterMode-ValidChars(default) and InvalidChars(低版本中不存在次屬性),設定其中任意一個值時,FilterType必須為Custom,也就是說FilterType是同時可以設定兩種類型(Custom和其中任意一中),具體可以參看例子
ValidChars-有效字元,FilterMode中必須有Custom
InvalidChars-無效字元,FliterMode中必須有Custom
FilterInterval-the default is 250ms
More Information of FilterTextBoxExtender
Demo>>>
1 <asp:ScriptManager ID="ScriptManager1" runat="server" />
2 <div>
3 <ajaxToolkit:FilteredTextBoxExtender ID="FilteredTextBoxExtender1" runat="server"
4 TargetControlID="TextBox1" FilterType="Numbers" ClientIDMode="Inherit">
5 </ajaxToolkit:FilteredTextBoxExtender>
6 <ajaxToolkit:FilteredTextBoxExtender ID="FilteredTextBoxExtender2" runat="server"
7 TargetControlID="TextBox2" FilterType="LowercaseLetters">
8 </ajaxToolkit:FilteredTextBoxExtender>
9 <ajaxToolkit:FilteredTextBoxExtender ID="FilteredTextBoxExtender3" runat="server"
10 TargetControlID="TextBox3" FilterType="Custom, Numbers" ValidChars="+-=/*().">
11 </ajaxToolkit:FilteredTextBoxExtender>
12 <table border="0">
13 <tr>
14 <td>
15 Only digits are allowed here:
16 </td>
17 <td>
18 <asp:TextBox ID="TextBox1" runat="server">
19 </asp:TextBox>
20 </td>
21 </tr>
22 <tr>
23 <td>
24 Only lower-case letters are allowed here:
25 </td>
26 <td>
27 <asp:TextBox ID="TextBox2" runat="server">
28 </asp:TextBox>
29 </td>
30 </tr>
31 <tr>
32 <td>
33 Only math symbols (+,-,*,/,=,.) and numbers:
34 </td>
35 <td>
36 <asp:TextBox ID="TextBox3" runat="server"></asp:TextBox>
37 </td>
38 </tr>
39 </table>
額外還想補充點,該控制項與驗證控制項不同的是,如果不符合的內容是無法輸入的。