Featured On ...

asp.net

totalasp.co.uk

fuzzysoftware.com

devdex.com

123aspx.com

dotnetfreaks.com

411asp.net

and more ...

ValidatorEntryDate

Full path

MadWidgets.Validation.ValidatorEntryDate

Declaration

public class ValidatorEntryDate : ValidatorEntrySingleObject

Hierarchy

Click on the selected class to view any properties or methods that may be accessible through an instance of this class through inheritance.

ValidatorEntryDate

Overview

The ValidatorEntryDate class is used to validate an object whose value represents a date under the Gregorian calendar. The format of the date can be forced to either be an unambiguous date format or either an unambiguous date and one of the ambiguous formats supported by various countries around the world.

Ambiguous date formats tend to resemble 02/01/2003 or the like whereas unambiguous date formats tend to resemble 2 Feb 2003. The validator does not accept ambiguous dates that don't include a 4 digit year value.

Accepted date formats can be found in the ValidatorEntryDate.Format enumeration, which is broken down in the following table.

Accepted format * ValidatorEntryDate.Format enumeration constant
YYYY[delimiter]MM[delimiter]DD or any unambiguous format YYYYMMDD
YYYY[delimiter]DD[delimiter]MM or any unambiguous format YYYYDDMM
MM[delimiter]DD[delimiter]YYYY or any unambiguous format MMDDYYYY
DD[delimiter]MM[delimiter]YYYY or any unambiguous format DDMMYYYY
Any format that does not conform to the regular expression: \d+[delimiter]\d+[delimiter]\d+ UnambiguousOnly

* Where YYYY is a 4 digit year, MM is a 1 or 2 digit month value and DD is a 1 or 2 digit day of month value. The set of delimiter characters is: \(backslash) /(forward slash) -(hyphen) or .(period)

Constructors

Public properties

Public static methods


Constructors

ValidatorEntryDate

public ValidatorEntryDate(object o, string sMessage, string sHighlightElement, bool bRequired, ValidatorEntryDate.Format f)

Creates a ValidatorEntryDate validating the object o, with a message, a client-side highlight element signature, a boolean indicating whether the object must have a non-blank value and a format value.

Public properties

Date

public DateTime Date {get;}

Returns the DateTime value found in the object supplied to the constructor after the form has been posted back.

If the value was blank or could not be parsed for some reason, DateTime.MinValue is returned from this property.

Public static methods

ClientSideParseDate

public static string ClientSideParseDate()

Returns a Javascript function called parseDate( . . . ), which is used to parse a date found in an object being validated based on the format supplied in the constructor of this class. The value returned from the method is used within the ClientSideCode() method but is made public static so that other ValidatorEntry subclasses that do not extend this class may gain access to it.

© 2002 - 2008 Copyright, Disclaimer and Privacy Statement