Reputation: 6305
I'm going through my colleagues code, he has written several Page.IsValid
checks but I can't find a single validation control on the pages.
Is it true that without any validation controls, the Page.IsValid
will always be true? And hence, it’s practically useless checking Page.IsValid
, isn't it?? please advice me with some info on this
Upvotes: 2
Views: 1997
Reputation: 2405
To use Page.IsValid
, first invoke Page.Validate()
, which sets Page.IsValid
to either true or false based on the validity of all validation server controls in the Page.Validators
collection.
If you access Page.IsValid
before invoking Page.Validate
it may not contain a correct value.
MSDN Documentation: http://msdn.microsoft.com/en-us/library/system.web.ui.page.isvalid(v=vs.71).aspx
Upvotes: 4