HTML 5 Updates for .NET 4

After we shipped .NET 4 we began working on the next version of the framework and one of the things that we have worked on for the next version of the framework is more support for HTML 5. We think that HTML 5 is so important that we have taken many of updates from the next framework and provided some of the most important ones as part of updates to .NET 4. This enables our customers to more easily develop HTML 5 applications now instead of waiting for the next framework. I’m going to highlight a couple of the updates and the major fixes they provide.

Update for the .NET Framework 4

The first update was shipped with VS 2010 SP1. You can read about the framework update here: One of the features of HTML 5 is there are now new input types such as date, url, email and more. While most browsers today don’t support these new input types you should still use them today because most mobile devices do support them and it changes the keyboard these devices display. For example specifying type=”email” will cause many phones to provide the “@” character on the keyboard. type=”email” or type=”url” will cause many phones to provide the “.com” button on the keyboard as a shortcut.

Before the update above it was illegal to use these input types in Web Forms. The following would generate an error:

<asp:TextBox id=”TextBoxEmail” runat=”server” type=”email” />

Because we were validating what values could be provided for the type= attribute. This validation was relaxed as part of the above update.

Reliability Update 1 for the .NET Framework 4

Earlier this week on patch Tuesday another update was released called the reliability update 1 for .NET 4: This update solves a variety of problems with HTML 5 input types. If you used any of the HTML 5 input types (a few mentioned above) with server controls they would not behave properly in the following cases:

UpdatePanel – The values of any HTML 5 input types would not be posted back on postback.

Validation Controls  - The ASP.NET validation controls such as asp:RequiredFieldValidator would not provide client validation on HTML 5 input types.

Callbacks – ASP.NET pages that are using callbacks would not post back the values of any HTML 5 input types.

All of these items were corrected with the second update listed above. Even more support for HTML 5 will be coming in the next version of the framework and we hope to start announcing details around that soon. Note the above two updates also fix quite a few other things in .NET 4 as well so I suggest you read the details from the links.