F
Fendi Baba
I wrote a simple validation routine. I am trying to trigger
validation
on group of fields if an option on another radio button is selected.
Sub ValidateAdd_ServerValidate(ByVal objSource As Object, ByVal
objArgs As ServerValidateEventArgs)
if radioDbutton.SelectedItem.Value="yes" Then
If objArgs.Value = "" Then
objArgs.IsValid = False
ElseIf DropDownList1.Text = "Select A Date" Then
objArgs.IsValid = False
ElseIf RadioButtonDTime.Text = "" Then
objArgs.IsValid = False
End If
end if
End Sub
I assigned the controltovalidate to one of the fields in the group.
and the page looks like this:
TR><TD style="HEIGHT: 16px" width=770px bgColor=#e1e0ff colSpan=4>
<asp:Label id="LabelDeliverAddress" runat="server" Text="Delivery
Address " Font-Bold="True" Visible="False"></asp:Label>
<asp:CustomValidator ID="CustomValidator1"
runat="server"
ControlToValidate="TextDAPT"
OnServerValidate="ValidateAdd_ServerValidate"
ErrorMessage="CustomValidator">*</asp:CustomValidator>
</TD></TR>
<TR><TD style="WIDTH: 162px; HEIGHT: 13px" bgColor=#efffff><asp:Label
id="LabelDAPT" runat="server" Text="Address Line 1" Font-Bold="True"
Visible="False"></asp:Label></TD>
<TD colspan=3 style="WIDTH: 241px; height: 13px;"
bgColor=#ffedfe><asp:TextBox id="TextDAPT" runat="server"
Width="600px" Visible="False"></asp:TextBox></TD>
</TR>
I have ohte validation on this page, but when I submit the page, only
the custom validation wont trigger. What did I do wrong?
validation
on group of fields if an option on another radio button is selected.
Sub ValidateAdd_ServerValidate(ByVal objSource As Object, ByVal
objArgs As ServerValidateEventArgs)
if radioDbutton.SelectedItem.Value="yes" Then
If objArgs.Value = "" Then
objArgs.IsValid = False
ElseIf DropDownList1.Text = "Select A Date" Then
objArgs.IsValid = False
ElseIf RadioButtonDTime.Text = "" Then
objArgs.IsValid = False
End If
end if
End Sub
I assigned the controltovalidate to one of the fields in the group.
and the page looks like this:
TR><TD style="HEIGHT: 16px" width=770px bgColor=#e1e0ff colSpan=4>
<asp:Label id="LabelDeliverAddress" runat="server" Text="Delivery
Address " Font-Bold="True" Visible="False"></asp:Label>
<asp:CustomValidator ID="CustomValidator1"
runat="server"
ControlToValidate="TextDAPT"
OnServerValidate="ValidateAdd_ServerValidate"
ErrorMessage="CustomValidator">*</asp:CustomValidator>
</TD></TR>
<TR><TD style="WIDTH: 162px; HEIGHT: 13px" bgColor=#efffff><asp:Label
id="LabelDAPT" runat="server" Text="Address Line 1" Font-Bold="True"
Visible="False"></asp:Label></TD>
<TD colspan=3 style="WIDTH: 241px; height: 13px;"
bgColor=#ffedfe><asp:TextBox id="TextDAPT" runat="server"
Width="600px" Visible="False"></asp:TextBox></TD>
</TR>
I have ohte validation on this page, but when I submit the page, only
the custom validation wont trigger. What did I do wrong?