Click here to Skip to main content
15,071,581 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have one textbox.This textbox take all character except double and single I can do this using regular expression validator(
Updated 7-Mar-12 4:24am
kashif Atiq 1-Feb-12 0:01am
do you want validator on your page to validate that user does not enteres " and ' in any specific field?

If you wrote some simple regex before, you should be able to do this with a little effort. However, if you have limited background regarding the subject matter, I suggest you go through the links first.


Regex with Javascript[^]

Test your regex with this tool[^]
You can also use the FilteredTextBoxEntender from the AjaxControlToolkit.
Then set following properties of the FilteredTextBoxExtender
FilterMode = Custom<br />
FilterType = InvalidChars<br />
InvalidChars = '" 
(without commas else comma will also be considered invalid.)
The following code can be used to disallow " and ' in TextBox
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server"
    ControlToValidate="TextBox1" ErrorMessage=" and ' are not permitted"
[no name] 24-Dec-12 1:51am
hi, I tried it but getting unexpected token.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900