Gross Date Field - ASP.NET Web control for month/year pair data entry and validation
Gross Date Field is an ASP.NET Web control that allows user to enter, display and validate
GrossDate (month/year pair) value.
Implementation
Gross Date Field is implemented by the GrossDateField class.
Documentation
Click here to see the documentation
of the GrossDateField class.
Validations
Gross Date Field supports validations in the following execution order.
- Not null validation
- Data format validation
- Compare to value validation
- Compare to control validation
- Range validation
- Custom validation
Custom Validation
Gross Date Field supports custom validation at both client-side and server-side. To setup
the custom validation error message, use the GrossDateField.CustomValidation.Message property;
to setup client-side custom validation, use the GrossDateField.CustomValidation.ClientValidator
property to specify the name of a JavaScript function that is used to perform client-side custom validation;
to setup server-side custom validation, handle the server-side CustomValidate event.
The custom client validator function must take one parameter which in run-time will receve the
validation context as a JSON object in the following format:
{"source":grossDatePartHolderIds, "data":grossDateObject, "callback":callbackFunction}.
Here the "source" is an array that holds the ids of the gross date part holder, e.g., context.source[0]
contains the month holder id, context.source[1] contains the year holder id; "data" is a JSON object
that contains the gross date to be validated in this format: {"year":yearValue, "month":monthValue};
"callback" contains a function that can be used during asynchronous custom validation
to notify the XField's Client Validation Engine about the result of the validation.
To perform synchronous custom validation, add validation logic in the custom client validator you
provide, and return a boolean value to indicate whether the field data passes the validation or not.
To perform asynchronous (Ajax) custom validation, first save the callback function somewhere
(typically in a global variable); then setup Ajax call to the server-side to handle custom validation.
After the Ajax call completes, notify the XField's Client Validation Engine about the result of
the validation by invoking the saved callback with a boolean value to indicate whether the
field data passes the validation or not.
View Custom Validation Demo of Gross Date Field.
Go to top