vb.net - Why won't my ASP.NET CustomValidator validate? -


I should do something wrong I can not execute my CustomValidator's ServerValidate method

I A Visual Basic ASP.NET page has been found with CustomValidator ...

  & lt; ASP .: Text Box ID = "Textbox 1" Runat = "Server" /> & Lt; ASP: CustomValidator id = "CustomValidator1" runat = "server" ControlToValidate = "TextBox1" error message = "Friendly message goes here." Display = "dynamic" /> & Lt; ASP: Button ID = "Button 1" Runat = "Server" text = "submit" reason validity = "true" />  

For this test, I always set the verification to fail ...

 SubCustomValidator1_ServerValidate (ByVal as the source object, ByVal Arg System.Web UI.WebControls.ServerValidateEventArgs) handles CustomValidator1.ServerValidate args.IsValid = false end sub 

But, when the button is clicked, the CustomValidator1_ServerValidate () method never executes!

 Protected Sub Button1_Click (ByVal) as this System.Object, ByVal E. System.EventArgs handles. Button1.Click Page.Validate () Page.IsValid then 'executes the code here, so! End if end sub 

Even if I do not explicitly validate that control ...

 CustomValidator1.Validate () 'Does nothing? 

What I'm doing wrong

add property :?

  ValidatePlat Text = "True"  

Comments