Click here to Skip to main content
15,884,986 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: , +
Hi ,

In my project am using one comparevalidator to check the value in textbox is integer or not.
XML
<asp:comparevalidator id="cmp" Runat="server" BackColor="Transparent" ControlToValidate="Textbox;
                            ErrorMessage="Enter numeric character only" Type="Integer" Operator="DataTypeCheck"></asp:comparevalidator>


It is working fine but the problem here is in my application i have one button called RESET.If i click that it should clear all textbox but here in my case if i enter any alphabets in text box and press RESET i will get validation message.Instead of that it should clear all the controls
How to do this?
Posted
Updated 24-Jun-13 20:06pm
v2

1 solution

How about you use a <code>FilteredTextBoxEditor instead of a CompareValidator. It is more appropriate for your situation. You don't have to do extra coding or any validation. Please check here[^].

Example usage for only allowing numbers:
C#
<ajaxToolkit:FilteredTextBoxExtender ID="ftbe" runat="server"
    TargetControlID="TextBox3"
    FilterType="Numbers"
    ValidChars="0123456789" />


Good luck,
OI
 
Share this answer
 
Comments
Am Gayathri 25-Jun-13 2:06am    
Thanks but
Am using .net 1.1 :(
Am Gayathri 25-Jun-13 5:31am    
Thnks

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