Wrox Programmer Forums
BOOK: Beginning ASP.NET 2.0 and Databases
This is the forum to discuss the Wrox book Beginning ASP.NET 2.0 and Databases by John Kauffman, Bradley Millington; ISBN: 9780471781349
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 2.0 and Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old July 6th, 2008, 06:13 AM
Registered User
Join Date: Apr 2008
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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

Old July 6th, 2008, 08:13 AM
Imar's Avatar
Wrox Author
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts

Hi there,

You may want to take a look here: http://converter.telerik.com/


Imar Spaanjaars
Everyone is unique, except for me.
Author of Beginning ASP.NET 3.5 : in C# and VB, ASP.NET 2.0 Instant Results and Dreamweaver MX 2004
Want to be my colleague? Then check out this post.

Similar Threads
Thread Thread Starter Forum Replies Last Post
Custom Server Control....Custom Property Editor ZArrinPour ASP.NET 1.0 and 1.1 Basics 1 June 15th, 2010 11:30 AM
Web Service, Custom Control, Custom Return Type robzyc ASP.NET 2.0 Basics 6 June 10th, 2008 08:03 AM
Custom Validation Control Client side event rodmcleay ASP.NET 1.0 and 1.1 Basics 3 December 17th, 2004 08:47 AM
Posting form After Custom Client-side validation rathbird General .NET 3 March 4th, 2004 06:03 PM
Custom validation fluff ASP.NET 1.0 and 1.1 Basics 2 November 19th, 2003 08:10 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.