Click here to Skip to main content
15,883,705 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have text box txtstdcode which take std code of user. txtstdcode is not mandatory field. so that user can't force to enter std code. i set the max length std code is 3. if user enter white space without enter std code it has to show error 'Dont enter space'. i dont want to use javascript .

regards,
Manohar Khillare
Posted

1 solution

Hey there,

Try RegularExpressionValidator:

ASP.NET
<asp:regularexpressionvalidator id="rev" runat="server" controltovalidate="txtBox" xmlns:asp="#unknown">
    ErrorMessage="Spaces are not allowed!" ValidationExpression="[^\s]+" /></asp:regularexpressionvalidator>


Let me know if it helps.

Azee...
 
Share this answer
 
Comments
Manohar Khillare 7-Oct-13 2:54am    
no its not working

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