Partager via


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: https://support.microsoft.com/kb/2468871. 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: https://support.microsoft.com/kb/2533523. 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.

Comments

  • Anonymous
    August 16, 2011
    Thanks for sharing... Please post more about HTML5 & .NET4

  • Anonymous
    August 17, 2011
    Hi, Since installing these updates, Safari and Chrome no longer post back values when I use the type="" attribute and an UpdatePanel. If I remove the attribute type="" (I am using date) then both browsers work fine. IE9 works fine using both methods. Regards Chris

  • Anonymous
    August 18, 2011
    i have downloaded both patch and installed. i m using Visual Studio 2010 Ultimate . when i go to Tools > Options > text Editors > HTML . not found option HTML 5 and in ASP.NET web controls not found "type" attributes in property. help me. how to get HTML 5 enabled in VS 2010.

  • Anonymous
    August 18, 2011
    Seems this latest update hasn't fixed anything in Chrome (v14.0.835.94 beta-m). At the very least input fields with type="number" do not post back any value when used within UpdatePanels. Wondering if this is something which could be fixed through a modified .browser file? FF6 and IE9 work fine in all instances - including with the latest .browser updates for them published this week here - www.hanselman.com/.../BugAndFixASPNETFailsToDetectIE10CausingDoPostBackIsUndefinedJavaScriptErrorOrMaintainFF5ScrollbarPosition.aspx

  • Anonymous
    August 19, 2011
    The comment has been removed

  • Anonymous
    August 19, 2011
    We modified the runtime to support these HTML 5 scenario's. Tools | Options | Text Editors is not modified by us changing the runtime. The change the above blog post talks about if you can not write <asp:TextBox id="TextBox1" runat="server' type="number"> and this will be valid and work with UpdatePanel, Validators and Page Call Backs

  • Anonymous
    September 18, 2011
    This code is not working. <asp:ToolkitScriptManager ID="ScriptManager1" runat="server">        </asp:ToolkitScriptManager>        <asp:UpdatePanel ID="UpdatePanel1" runat="server">        <ContentTemplate>                       <asp:Label ID="Label1" runat="server"></asp:Label>               <asp:TextBox ID="TextBox1" runat="server" type="number"></asp:TextBox>               <asp:Button ID="Button1" runat="server"  />        </ContentTemplate>        </asp:UpdatePanel> This code works <asp:ScriptManager ID="ScriptManager1" runat="server">        </asp:ScriptManager>        <asp:UpdatePanel ID="UpdatePanel1" runat="server">        <ContentTemplate>                       <asp:Label ID="Label1" runat="server"></asp:Label>               <asp:TextBox ID="TextBox1" runat="server" type="number"></asp:TextBox>               <asp:Button ID="Button1" runat="server"  />        </ContentTemplate>        </asp:UpdatePanel> There is some problem in toolkitscriptmanager, I want to make it works, but how ? Please advise.

  • Anonymous
    November 02, 2011
    Gareth and Matang, I had the same problem and identified that it is caused by a different version of MicrosoftAjaxWebForms.js used in the AJAX control toolkit.  I have logged it as an issue with the toolkit: ajaxcontroltoolkit.codeplex.com/.../27041

  • Anonymous
    November 29, 2011
    will the Reliability Update 1 for the .NET Framework 4 allow for server side input controls on web forms? <input type="email" name="myEmail" id="myEmail" runat="server" /> i installed this, but still get the Parser Error "'email' is not a valid type for an input tag."

  • Anonymous
    February 26, 2012
    Hi Scott I went through your Dynamic Data on the .NET 4.0 Tutorial it answered all the questions I had in mind Good job Thanks!

  • Anonymous
    January 28, 2014
    Hi . Is not working on IIS 6. any Suggestions? Thanks