ken bus said:
To reproduce the bug do the following:
1) only use the validators for the server side; no client support of
validation.
But stop right there..... This is a little like saying "Remove one wheel
from your automobile and you'll find that your car doesn't drive correctly!"
2) place a textbox,textbox1, and a customvalidator, val1, that is bound to
the textbox1 on to the web form; another validator of some kind, val2, that
is bound to another textbox, textbox2 on to the same web form.
3) produce an invalid condition in textbox2 so that val2 is notifying the
invalid condition and val1 will not display its notification of an invalid
input for textbox1 even if there is input in textbox1.
Of course it won't, you didn't include any code for server-side validation
of val1 so how could it validate itself and decide it failed?
4) produce a postback and only val2 will display its invalid input condition.
5) val1 will behave as expected if textbox2's invalid input is corrected
and val2 is not notifying anymore.
That's not what I get. When I add valid data to val2, its error message
goes away and val1 sits there as it had before.
The point is this, you aren't using these validators correctly and so it's
not surprising that you are encountering anomolies. A custom validator
needs to have custom server-side code written so that it knows what to do
when the time comes, you didn't include any of that in your example, so of
course val1 does not report any invalid conditions.
NOTE: that the server-side event handler must be setup correctly since it
does fire when textbox2's invalid state for input is cleared.
Code behind follows:
Public Class TempTest
Inherits System.Web.UI.Page
#Region " Web Form Designer Generated Code "
'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
End Sub
Protected WithEvents TextBox1 As System.Web.UI.WebControls.TextBox
Protected WithEvents Button1 As System.Web.UI.WebControls.Button
Protected WithEvents TextBox2 As System.Web.UI.WebControls.TextBox
Protected WithEvents val1 As System.Web.UI.WebControls.CustomValidator
Protected WithEvents val2 As System.Web.UI.WebControls.RequiredFieldValidator
'NOTE: The following placeholder declaration is required by the Web Form Designer.
'Do not delete or move it.
Private designerPlaceholderDeclaration As System.Object
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub
#End Region
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
End Sub
Protected Sub TextValidate(ByVal source As System.Object, ByVal args As System.Web.UI.WebControls.ServerValidateEventArgs)
args.IsValid = False
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click