Custom Validation c# example
asp.net 2.0 databases p344 custom validator
This is a great example and one of the few places on the net that shows me how to do this. Problem is I need the script in c#, and I cannot get this to work. Can anyone show me the proper script in c# for the code below in the example
Thanx in advance;)
<script runat="server">
Protected Sub CustomValidator1_ServerValidate(ByVal source As Object, ByVal args As System.Web.UI.WebControls.ServerValidateEventArgs)
' must be under age 25 to get a student membership
If RadioButtonList1.SelectedValue = "S" And _
CDate(DobTextBox.Text) < DateAdd("yyyy", -25, Today()) _
Then args.IsValid = False
' must be over 65 to get an emeritus membership
If RadioButtonList1.SelectedValue = "E" And _
CDate(DobTextBox.Text) > DateAdd("yyyy", -65, Today()) _
Then args.IsValid = False
End Sub
</script>
|