PC Review


Reply
Thread Tools Rate Thread

CustomValidator problem...

 
 
RTT
Guest
Posts: n/a
 
      31st Mar 2005
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?


 
Reply With Quote
 
 
 
 
RTT
Guest
Posts: n/a
 
      31st Mar 2005
solved with page.isvalid to trigger validation


"RTT" <(E-Mail Removed)> wrote in message
news:%23YU$(E-Mail Removed)...
> 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?
>
>



 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
CustomValidator problem testemailsystem.test@gmail.com Microsoft ASP .NET 2 14th Jul 2008 07:09 AM
problem with customvalidator Jeff Microsoft ASP .NET 2 18th Mar 2008 04:04 PM
newbie: Problem with CustomValidator Jeff Microsoft ASP .NET 2 8th Feb 2007 04:22 PM
Problem with CustomValidator Nathan Sokalski Microsoft ASP .NET 1 18th Jun 2005 03:48 AM
customvalidator problem bill yeager Microsoft ASP .NET 1 28th Aug 2003 04:16 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:10 AM.