I am trying to validate a control based on the value of another contril and really don't know where to start. This is what I have so far which doesn't work yet.
My sub is
Protected Sub healthyes( _
ByVal sender As System.Object _
, ByVal objArgs As ServerValidateEventArgs)
Dim bIsValid As Boolean = False
Dim strTemp As String
strTemp = healthpart.SelectedItem.Text
If strTemp = "yes" Then
objArgs.IsValid = True
Else
objArgs.IsValid = False
End If
End Sub
my control is
<asp:customvalidator
ControlToValidate="healthpart"
ClientValidationFunction="healthyes1"
OnServerValidate="healthyes"
Display="Dynamic"
CssClass="errormessages"
Text="You have verified that the user has insurance. Please enter a date."
/>
here is what I am really trying to do. Say I have a dropdown menu with the values of yes and no. If the value of the dropdown is equal to yes then a second element which is a textbox must have a value. I am just lost right now.
My sub is
Protected Sub healthyes( _
ByVal sender As System.Object _
, ByVal objArgs As ServerValidateEventArgs)
Dim bIsValid As Boolean = False
Dim strTemp As String
strTemp = healthpart.SelectedItem.Text
If strTemp = "yes" Then
objArgs.IsValid = True
Else
objArgs.IsValid = False
End If
End Sub
my control is
<asp:customvalidator
ControlToValidate="healthpart"
ClientValidationFunction="healthyes1"
OnServerValidate="healthyes"
Display="Dynamic"
CssClass="errormessages"
Text="You have verified that the user has insurance. Please enter a date."
/>
here is what I am really trying to do. Say I have a dropdown menu with the values of yes and no. If the value of the dropdown is equal to yes then a second element which is a textbox must have a value. I am just lost right now.