PDA

Click to See Complete Forum and Search --> : Here's How to Change Your Default DOCTYPE


nemaroller
Mar 22nd, 2005, 01:39 PM
For a year I always wanted to change the DocType Visual Studio assigns to new webforms...

here's the answer:

Anytime you add a new web page, you're using automation aspects of VS to put that web page into your project.

That default web page actually exists on your hard drive. If you want to change it, go to the locations listed below for your language. All you need to do is open up WebForm1.aspx in your IDE, and configure it as you see fit. In my case I changed the archaic doctype to the fully qualified doctype
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 >

to

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">

If you use the old doctype as delivered with VS, IE6, FireFox and other browsers don't properly enter quirks mode and you will have a hell of a time acheiving cross-browser compatibility. IE6 throwsback to IE5 rendering bugs if you don't have a fully qualified doctype.

Anyway, here's the location of the template WebForms (remember, you're looking to change WebForm1.aspx and it doesn't hurt to make a backup copy in case you mess it up):

C#:
C:\Program Files\Microsoft Visual Studio .NET 2003\VC#\VC#Wizards\CSharpAddWebFormWiz\Templates\1033

VB:

C:\Program Files\Microsoft Visual Studio .NET 2003\Vb7\VBWizards\WebForm\Templates\1033