costum validator problem

RTT

Active member
Joined
Mar 16, 2005
Messages
26
Programming Experience
Beginner
It's my first time i want to write a cotum validator but it doesn't seem to
work. In de page i've put this validator:
<asp:CustomValidator id="CVFBeginDate"
OnServerValidate="CVFBeginDate_ServerValidate" runat="server"
ErrorMessage="Please fill in a valid date as startdate"
ControlToValidate="TxtBeginDate">*</asp:CustomValidator>

in de codebehindpage i have created this sub:
Protected Sub CVFBeginDate_ServerValidate(ByVal source As System.Object,
ByVal args As System.Web.UI.WebControls.ServerValidateEventArgs) Handles
CVFBeginDate.ServerValidate
Try
tmp = args.Value.Split("/")
testDate = New Date(tmp(2).ToString(), tmp(1).ToString(),
tmp(0).ToString())
args.IsValid = True
Catch
args.IsValid = False
End Try
End Sub


it doesn't seem to work. do you have to put something special to the custom
validator?
 

RTT

Active member
Joined
Mar 16, 2005
Messages
26
Programming Experience
Beginner
solved. had to use page.isvalid to trigger validation
 
Top Bottom