When does the OnValidate
event fire in the life-cycle of a control?
I'm creating a DateBox
that will allow the user to enter a date in MM/DD/YYYY format (text) and need to verify that the date is in that format. It'll never be converted to a date (stored as string) but I would like to know the best time to validate that data (and provide feedback).
Note: It may seem a bit like re-inventing the wheel, but the app that I'm writing gets deployed to a tablet-pc and the winforms DateTimePicker
is hell to edit with a stylus and my users just want to be able to write in the date.
MaskedTextBox Control might help you.
OnValidate happens after the Loading events ( source )
You should validate on the client-side (javascript) AND server side either using the OnValidate or when handling the submission of the form (or both).
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.