Featured On ...

asp.net

totalasp.co.uk

fuzzysoftware.com

devdex.com

123aspx.com

dotnetfreaks.com

411asp.net

and more ...

ValidatorEntryDateComparer

Full path

MadWidgets.Validation.ValidatorEntryDateComparer

Declaration

public class ValidatorEntryDateComparer : ValidatorEntryComparer

Hierarchy

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

ValidatorEntryDateComparer

Overview

The ValidatorEntryDateComparer class is used to validate the comparison between two related objects (e.g. form fields) whose values represent dates. You can optionally include a tolerance or difference period in the constructor of this class conforming to the following rules:

[- or +][an integer value][a period part character]

Where the - and + sign is optional. If it is excluded, + is assumed. The integer value specifies how many period parts to add or subtract. The period part can be one of the following:

  • y - year
  • m - month
  • d - day
  • H - hour
  • M - minute
  • S - second

One or all of these period parts can be included in the difference expression, an example of which is:

"-1y 11m 4H"

This example tells the ValidatorEntryDateComparer to: subtract 1 year, add 11 months and add 4 hours to the date value found in the first validated object passed to the constructor (o1) before making the comparison between the two objects as determined by the ComparisonMethod constant. This example is equivalent to the expression:

"-1m 4H"

This class requires the Date.js Javascript file provided with the ASP.NET Validation Package to be loaded into the page before client-side validation can take place. You should specify the path to this file in the appSettings section of the web.config file using the property name validatorDateScriptPath. The following code block shows how this has been done for this site.

<add key="validatorDateScriptPath" value="/Controls/Validation/Date.js" />

Constructors


Constructors

ValidatorEntryDateComparer

public ValidatorEntryDateComparer(object o1, object o2, ComparisonMethod cm, string sMessage, string sHighlightElement, ValidatorEntryDate.Format f)

Creates a ValidatorEntryDateComparer based on the two input objects o1 and o2 and a compare method together with a message, a client-side highlight element signature and a date format as specified by the ValidatorEntryDate.Format enumeration.

ValidatorEntryDateComparer

public ValidatorEntryDateComparer(object o1, object o2, ComparisonMethod cm, string sMessage, string sHighlightElement, ValidatorEntryDate.Format f, string sDifferencePeriod)

Creates a ValidatorEntryDateComparer based on the two input objects o1 and o2 and a compare method together with a message, a client-side highlight element signature, a date format as specified by the ValidatorEntryDate.Format enumeration and a difference period expression as defined above.

© 2002 - 2008 Copyright, Disclaimer and Privacy Statement