tags:

views:

123

answers:

5

A link would be great. Thanks.

+7  A: 

The platform has no bearing on whether you can use HTML 5 or not.

For example, if you have an asp.net web forms project, you can certainly make your .aspx files be HTML 5 compliant ... or not. Your choice.

To be clear, MVC, web forms, or whatever else has no bearing either. Those are, to simplify quite a bit, just processing technologies. You could deliver pure javascript and let that build your page client side if you wanted with any of them.

By the same token, php, java, ruby, etc can all be used to write html 5 compliant sites. If you were really ambitious you could even do it in pascal or c... or, if truly masochistic, ColdFusion ;)

Chris Lively
While it's technically possible, I think the OP is referring to the fact that many controls in webforms don't really produce the most standards-compliant HTML, and you technically don't have much control over what they produce period.
Scott Anderson
@Scott: I'm not entirely sure how you got from the OP's statement of "using HTML 5" to "webforms don't really produce the most standards-compliant HTML" for a spec that isn't completed yet... The spec is still under development, which means nothing can produce compliant code by default. Also, I seem to be missing the part where the OP was talking about the built in .net controls in his question.
Chris Lively
He said "ASP.NET without MVC." To me that implies webforms. Also, even though HTML 5 is a draft, some controls don't even really produce compliant HTML 4, so it was more of a general statement about the state of things in webforms overall. HTML 5 might not be ratified yet, but I fail to see how that has anything to do with producing compliant HTML now. By the time HTML5 and CSS3 are fully ratified, the industry as a whole will have been using them for 10 years.
Scott Anderson
@Scott: no doubt about the 10 year comment ;)
Chris Lively
+4  A: 

There's not built-in controls in ASP.Net which uses html5 yet. But you can download a html5 schema which will work with VS2008 and VS2010 so you get intellisense on html5 compliant html.

http://blogs.msdn.com/b/webdevtools/archive/2009/11/18/html-5-intellisense-and-validation-schema-for-visual-studio-2008-and-visual-web-developer.aspx

Read the comments for using it with VS2010.

Mikael Svenson
ASP.NET 4 also cleans up HTML a lot. ViewState is reduced also, and ClientID's can be used reliably within JavaScript. It's a lot easier to write a webforms app with HTML5 than it was before ASP.NET 4 :)
Scott Anderson
For 2010, here's an additional link to get it working: http://www.raihaniqbal.net/blog/2010/08/html5-support-in-visual-studio-2010/
Chris Lively
A: 

If I had to choose between yes and no to this answer, I would have to say no.

All the built in controls in ASP.NET Web Forms do not generate HTML 5 code. They do generate HTML 4 compliant code, but it is not pretty by todays standards, especially because a lot of the controls use tables to render their layout. It is possible to change the html code for all the controls using CSS Friendly Control Adapters (http://www.asp.net/cssadapters/). In fact, I would advise you to check out that website, since it illustrates some of the bad markup of ASP.NET.

You can of course make an ASP.NET website without using the built in controls, but then I would advise to use MVC instead.

Correction: Sure it is possible to use ASP.NET to generate HTML 5, since HTML 5 is generally backwards compatible. But I wouldn't recommend the platform if you intent to create a state of the art HTML 5 web application for smartphones.

Jan Aagaard
You should check out the RenderingMode property that was added to a lot of controls in ASP.NET 4 that can remove tables :)
Scott Anderson
I can only find RenderingMode on the Menu control. What other controls have that property now?
Jan Aagaard
+1  A: 

Of course it is. You will probably have to avoid the default set of controls, but there is absolutely nothing that prevents you from having strict HTML5 valid code. (Whatever that means).

Andrew Lewis
A: 

Here is a good link describing what is possible and advisable now in forms: http://diveintohtml5.org/forms.html , a lot of it is simple, backwards-compatible, and improves user experience (see especially placeholders, search inputs, email address input fields, url input types). There is no reason not to use these now, and they help a lot on mobile devices.

I think in asp.net you would have to use custom controls for some of it (ie, a text field hack that was designed by the WHATWG specifically to trick IE is not a core part of existing control objects.) An easier work-around might look like this:

<asp:TextBox id="textbox1" runat="server" />

This yields html:

<input name="textbox1" type="text" id="textbox1" />

But your customer wants type="email" so you are in full Steve Jobs compliance mode. Simple work-around might be to add this javascript: document.getElementById("textbox1").type = "email". You would do the same ...etc_etc).type = "search" if you have a text box for search input and you want the benefits of html5 for users on devices that have usability enhancements for them.

See again here for more discussion. Also, apart from forms you should be able to use canvas, web storage, etc., via javascript.

bvmou