CustomValidator1_ServerValidate Doesn't Work !

R

Raheel Hussain

hi,

I have different controls on my form (most of them with required field
validators)

one of which is a date field with a custom field validator on it, but i
don't knwo why its is not called , i tried it in debug mode but the
function not called at all.

all the required field validators functions are being called properly.

i m pasting my code below, can any body tell me whts the problem with my
code.

regads

server side code
''''''''''''''''''''''''''''''
Private Sub CVal1_ServerValidate(ByVal source As System.Object, ByVal
args As System.Web.UI.WebControls.ServerValidateEventArgs) Handles
CustomValidator1.ServerValidate

If IsDate(args.Value) And Trim(args.Value) <> "" Then
args.IsValid = True
Exit Sub
End If
End Sub

HTML CODE
'''''''''''''''''''''''''''''
<asp:textbox id="txtDateIn" runat="server"
CssClass="formObject">2/2/2002</asp:textbox>

<asp:customvalidator id="CustomValidator1" runat="server"
EnableClientScript="False" ControlToValidate="txtDateIn"
ErrorMessage="*"></asp:customvalidator>




*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!
 
P

Peter Blum

Microsoft has already provided a validator for checking dates are valid:
CompareValidator with Operator=DataTypeCheck and Type="Date".

Regarding your custom validator, do you know if its getting called or not?
We need to know if its a hookup or logic problem.

--- Peter Blum
www.PeterBlum.com
Email: (e-mail address removed)
Creator of "Professional Validation And More" at
http://www.peterblum.com/vam/home.aspx
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,773
Messages
2,569,594
Members
45,119
Latest member
IrmaNorcro
Top