On a particular custom list item form I am making for my WSS 3.0 web app, I am required to validate the page when it is loaded up, so that any mistakes the user makes from a previous save are noted immediately. I currently do it by using
Page.Validate() in the
With all of the
RadioButtonList controls I populate (also on page load), I can simply populate them before I trigger a bunch of
InputFormCustomValidator controls on the page. For those controls, everything is clear and the correctly filled out fields are not marked as invalid.
But for the
DateTimeField controls, it will treat them as empty for the page load validation whether or not they have data in them. This occurs both when using the actual
DateTimeField controls that automatically fetch data based on the item ID querystring, and when using the underlying
DateTimeControl controls which I prepopulate on page load like the text boxes.
Once there's been a post-back that calls for validation, the validation will properly recognize the contents of those fields.
Is there something I can do to get around this, so that correctly filled User and DateTime fields are not marked as invalid on page load? Should I run the validation in a different method than
OnLoad? I'd personally like to keep the fields as
DateTimeField rather than using the underlying controls, but that restricts me to not being able to define when they get populated. If the solution is to move the control pre-population to an earlier stage in time, I can settle for that, but it remains preferable not to have to do so if it can be fixed in another way.