Subject: Re: how to create a RegularExpressionValidator in runtime ? ?
Date: Wed, 26 Nov 2003 13:41:29 -0200
Lines: 48
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
Message-ID: <
[email protected]>
Newsgroups: microsoft.public.dotnet.framework.aspnet
NNTP-Posting-Host: 200-171-96-217.speedyterra.com.br 200.171.96.217
Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP12.phx.gbl
Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework.aspnet:193512
X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
Sure, here we go:
Public Shared Function Test(ByVal campo As TextBox)
Dim rf As New RegularExpressionValidator
rf.ID = "rf"
rf.Enabled = True
rf.Visible = True
rf.Display = ValidatorDisplay.Dynamic
rf.ErrorMessage = "You must enter a value"
rf.Text = "*"
rf.ValidationExpression = "\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"
rf.ControlToValidate = (campo.ID)
rf.EnableClientScript = True
rf.EnableViewState = False
rf.Validate = campo
End Function
but this code above, it seems to do nothing when i use it on a button (on
click event). Something is missing to this simple code work fine.
could you help me up ?