c# - Text with RegEx Validator not working -
c# - Text with RegEx Validator not working -
i have issue next text display:
<asp:regularexpressionvalidator id="password_regularexpvalidate" runat="server" text="test!" display="dynamic" borderstyle="none" controltovalidate="txtnewpass" validationexpression="(?=^.{8,255}$)((?=.*\d)(?=.*[a-z])(?=.*[a-z])|(?=.*\d)(?=.*[^a-za-z0-9])(?=.*[a-z])|(?=.*[^a-za-z0-9])(?=.*[a-z])(?=.*[a-z])|(?=.*\d)(?=.*[a-z])(?=.*[^a-za-z0-9]))^.*" meta:resourcekey="password_regularexpvalidateresource1" /></td> the pattern is:
(?=^.{8,255}$)((?=.*\d)(?=.*[a-z])(?=.*[a-z])|(?=.*\d)(?=.*[^a-za-z0-9])(?=.*[a-z])|(?=.*[^a-za-z0-9])(?=.*[a-z])(?=.*[a-z])|(?=.*\d)(?=.*[a-z])(?=.*[^a-za-z0-9]))^.* the text had stuff in validationexpression different. i've changed regex look , works, when write in text= doesn't update on page. i've restarted iis, cleard ie chache... think of. old text keeps appearings (ie. "test!" doesn't show when validation fails should).
any help appreciated.
edit:
the code txtnewpass:
<asp:textbox id="txtnewpass" runat="server" textmode="password" maxlength="256" meta:resourcekey="txtnewpassresource1"></asp:textbox> also, it's worth noting can remove entire table page disappears when reload page. when alter text values controls or runat="server" , page doesn't seem update text....
and code behind doesn't edit field displays, validator validates text in textbox , uses value later.
edit 2: same thing happening -
<asp:label id="label1" runat="server" text="change password!!!!!" meta:resourcekey="label1resource1"></asp:label></td> i've added exclamation marks (!!!!!) , that's not showing when refresh page either.....
edit 3: i've noted in 1 of comments, if delete table page , reload page, table disappears, know page reloading properly. runat="server" property, work way caches text or something? i'm out of ideas....
like kirill said, utilize errormessage instead of text.
but main problem is, think, localization, handled through meta:resourcekey tag , resources. here explanation: asp.net meta:resourcekey
if set automatically or manually resource localization file , alter afterwards, illustration label text property, need in resource file too. because there should initial value, loaded @ runtime.
c# asp.net regex validation
Comments
Post a Comment