Valid XHTML within .NET


The first article in this series will concentrate on the HtmlForm control and its child controls, deciding how we can best modify the default implementation and extend its capabilities so that it will validate to the W3C's XHTML 1.0 and 1.1 strict standards. Additionally we'll look at how the default instance uses client-side validation and how this too can be improved.

In order to test and run sample code included in this document, a text editor and C# compiler will be required along with an ASP.NET compatible Web server. All sample code has been developed and tested using Windows 2000 Professional running IIS 5.0 and version 1.1 of the .NET Framework. There should be no issues using later versions of Windows operating system. It is also possible to use the "Mono" project's compiled source-code running on most Linux distributions.


The source-code in this article is written in C# and ASP.NET. It is assumed that you have a basic understanding of both C# and ASP.NET as well as the essentials of the CLR (or equivalent runtime) and its associated development tools. The code listed is CLS-compliant so you can easily replace the C# code with an alternate CLI-compatible language. It is also assumed that the requirements for creating XHTML compliant Web pages are understood.


This article makes no provisions for the XHTML-Basic standard as this is targeted at mobile devices and thus covered by Microsoft's ASP.NET mobile controls.

XHTML 2.0 is currently unsupported by most major browsers or has yet to make recommended status and is thus out of the scope of this article. The solutions discussed here can be applied to this standard if required.

You might also like...



Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Nine people can't make a baby in a month.” - Fred Brooks