The controls in the ASP.NET
<asp:TextBox ID="txtEnd" runat="server" placeholder="12:59"></asp:TextBox>
<asp:RadioButtonList ID="rblTime2" runat="server" RepeatDirection="Horizontal" RepeatLayout="Flow">
<asp:ListItem>AM</asp:ListItem>
<asp:ListItem>PM</asp:ListItem>
</asp:RadioButtonList>
CustomValidator
<asp:CustomValidator ID="ValidateStartTime" ControlToValidate="txtEnd" OnServerValidate="ValidateStartTimeFun" runat="server" ErrorMessage="*required"></asp:CustomValidator>
CodeBehind
protected void ValidateStartTimeFun(object source, ServerValidateEventArgs args)
{
try
{ if (txtStart.Text != "" && rblTime.SelectedValue != null )
{ args.IsValid = true; }}
catch (Exception ex)
{ args.IsValid = false; }
}
It doesn't even give me a *required if I change the entire CodeBehind to this;
protected void ValidateStartTimeFun(object source, ServerValidateEventArgs args)
{
args.isValid = false;
}