Sometime, Dan gets things wrong in this series of posts and is corrected/advised by users in the comments. Dan always takes the comments on board and suggests ways to incorporate these thoughts and improve the code, or changes the code examples as a result of the feedback. Dan’s lack of ego and willingness to improve things adds more value to these pages – so make sure you read the comments!
Update: This series of blog posts is now available as a video course on Pluralsight.
In HTML, the content type between the <script> tags is treated as CDATA which means that entities enclosed within it will not be parsed.
In XHTML, the content between the <script> tags is treated as #PCDATA which means that it will be parsed. So, to avoid having to encode the data between the tags we enclose it in a CDATA section.
The end result is that the page will validate as XHTML and will still work in older browsers.
Note: In either case, we no longer use the deprecated “language” attribute.
Page_IsValid – A global boolean variable indicating if the page is valid.
Page_Validators – An array containing all the validation controls on the page.
ValidatorValidate(Validator) – Calls the validation function for a specified Validation control. Validator is an actual control reference, not an id.
This will update the global Page_IsValid boolean variable.
Page_ClientValidate() – Calls the validation routine for all validation controls in the Page_Validators array. This will update the global Page_IsValid boolean variable.