0

I have a question related to Web Forms. Do the ASP.NET Web Controls provided in Visual Studio 2012 emit HTML5 as output?

I understand we can use custom controls or content adapters to make web control emit HTML5 even with Visual Studio 2010 and probably earlier versions with support for .NET framework 2.0, but I am interested in the DEFAULT behavior; that is, without going for any work around or our own implementation.

So has anyone of you checked the DEFAULT output of web controls provided in Visual Studio 2012?

Furqan Safdar
  • 14,930
  • 12
  • 52
  • 85
Jazz
  • 1
  • 1
  • 1
  • I believe they output XHTML 1.0, and as far as I know all XHTML 1.0 tags are also supported in HTML5. Clearly if you want to use a tag that is new in HTML5 there might not be an ASP.net control that represents it. I use a HTML doctype and the default ASP.net controls in .Net 4 and VS 2010 and this produces documents that validate against the doctype. – Bazzz Oct 02 '12 at 07:59
  • Bazzz! I quickly validated the sample outout with w3c validator and it seems most of the things will be validated though calendar control in the sample output had several validation issues. Probably this will also be the case with some other advance web controls. In general, you are right. – Jazz Oct 05 '12 at 05:05

1 Answers1

0

There is a web standards update available for visual studio that will output HTML 5 controls available here

However normally visual studio will output generic HTML:

<select name="ctl00$ContentPlaceHolder1$reportName" id="ctl00_ContentPlaceHolder1_reportName" class="input-large">
        <option value="Finance">Finance</option>
        <option value="Sales">Sales</option>
        <option value="RealEstate">RealEstate</option>>

    </select>

With it's own ID addition (if not specified to not use that in the web.config

Ryan McDonough
  • 9,202
  • 3
  • 51
  • 73
  • Ryan! Thank you for referring Web Standards Update. It is indeed helpful but it just adds intellisense support for html5, ccs3, js, etc. in Visual Studio's editor. It does not have any effect on the output of the built-in web controls which remains XHTML. – Jazz Oct 05 '12 at 04:58
  • Ah that's a shame, glad it is somewhat helpful though :) – Ryan McDonough Oct 05 '12 at 06:52
  • 1
    One of the reasons why I will try to push MVC vs Web Forms. More control over the HTML in the view than with the code behind framework. – NicVerAZ Mar 21 '13 at 23:57