regex - RegularExpressionValidator asp.net -


i trying make sure user can input a-z , 0-9 characters. have used regularexpressionvalidator class:

<asp:textbox id="input" text="search" runat="server" ontextchanged="searchfunc"></asp:textbox> <asp:regularexpressionvalidator id="regexp" runat="server"                                           errormessage="only a-z or 0-9 allowed"                                      controltovalidate="input"                                              validationexpression="^[a-z0-9]+$" /> 

though in code behind trying check if user entered valid input using

regexp.isvalid 

but method returns true if user inputs !&%() can't understand i've done wrong. regular expression wrong?

call regexp.isvalid after validation has been performed otherwise default value set true.

try calling regexp.validate() before checking isvalid property.


Comments

Popular posts from this blog

windows - Single EXE to Install Python Standalone Executable for Easy Distribution -

c# - Access objects in UserControl from MainWindow in WPF -

javascript - How to name a jQuery function to make a browser's back button work? -