A
Ananda Sim
Hi All,
I'm having problems setting up a validation mechanism that covers three
optional <asp:textbox> - Only one of these need to be filled - any one.
The standard RequiredFieldValidator will insist on each one being filled. I
thought I could use the Page_Load handler but if the second postback makes
one validator happy, then other two persist in being not valid so the
..Enabled=False does not seem to be doing what I expect.
Any tips on how to do this?
Thanks
Ananda
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
If IsPostBack Then
If (Me.txtHome.Text = "" And Me.txtWork.Text = "" And Me.txtMobile.Text =
"") Then
Me.HomePhoneValidator.Enabled = True
Me.WorkPhoneValidator.Enabled = True
Me.MobilePhoneValidator.Enabled = True
Me.Validate()
Else
Me.HomePhoneValidator.Enabled = False
Me.WorkPhoneValidator.Enabled = False
Me.MobilePhoneValidator.Enabled = False
Me.Validate()
End If
End If
End Sub
I'm having problems setting up a validation mechanism that covers three
optional <asp:textbox> - Only one of these need to be filled - any one.
The standard RequiredFieldValidator will insist on each one being filled. I
thought I could use the Page_Load handler but if the second postback makes
one validator happy, then other two persist in being not valid so the
..Enabled=False does not seem to be doing what I expect.
Any tips on how to do this?
Thanks
Ananda
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
If IsPostBack Then
If (Me.txtHome.Text = "" And Me.txtWork.Text = "" And Me.txtMobile.Text =
"") Then
Me.HomePhoneValidator.Enabled = True
Me.WorkPhoneValidator.Enabled = True
Me.MobilePhoneValidator.Enabled = True
Me.Validate()
Else
Me.HomePhoneValidator.Enabled = False
Me.WorkPhoneValidator.Enabled = False
Me.MobilePhoneValidator.Enabled = False
Me.Validate()
End If
End If
End Sub