Click here to Skip to main content
15,910,878 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all,
i want to allow only 8 length character string to type in textbox.
how can i validate the textbox using ragevalidator?
Posted

Set you textbox maxlength="8" and then use range validator to give range using Minimum value="" maximumvalue="" Type="string"

Do the above one's and then say
 
Share this answer
 
Comments
amit_83 21-Jan-12 7:14am    
Thanks for reply, i tried but not working
asp:RangeValidator ID="RequiredFieldValidator7" runat="server" ControlToValidate="txtPolicy"
Display="Static" ErrorMessage="Policy number must be 8 character long" ValidationGroup="txtValidate"
Type="String" MinimumValue="8" MaximumValue="8" />
Prashant Srivastava LKO 22-Jan-12 12:16pm    
set your Display="Dynamic" setfocusonerror="true" try then tell
Set your Textbox's maxlength = "8" and simply use RegularExpressionValidator

See link below, it may help you
http://forums.asp.net/p/1553278/3813601.aspx[^]
 
Share this answer
 
Comments
amit_83 21-Jan-12 7:14am    
Thanks for reply, i tried but not working asp:RangeValidator ID="RequiredFieldValidator7" runat="server" ControlToValidate="txtPolicy" Display="Static" ErrorMessage="Policy number must be 8 character long" ValidationGroup="txtValidate" Type="String" MinimumValue="8" MaximumValue="8" />

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