By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,165 Members | 1,508 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,165 IT Pros & Developers. It's quick & easy.

CustomValidator problem...

P: n/a
RTT
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?
Nov 21 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
RTT
solved with page.isvalid to trigger validation
"RTT" <RT*@pandora.be> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
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?

Nov 21 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.