Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / web / ASP.NET

Demo Application Showing the Use of Html5MVCWebControls Class Library

4.73/5 (9 votes)
21 Sep 2011CPOL2 min read 54.2K   4K  
Demo Application showing the use of Html5MVCWebControls Class Library which is from my previous article.

Introduction

Well, this is my twelfth article just showing the use of the class library developed for ASP.NET MVC 3 for the use of HTML 5 controls. You can see the details about the class library in my previous article.

Background

For my previous article about HTML 5 controls for ASP.NET MVC, I found some comments about giving an example application of how to use the html5 class library controls for ASP.NET MVC. Some users mentioned to give a demo application for a clear understanding. So I tried this and posted so that the users can come to a good idea of the use of the class library. You can see a good output in Google Chrome since it supports most of the HTML 5 controls. I have given a table below which describes the output obtained in different browsers. Actually I tested the whole thing in Google Chrome where I got good output.

Controls

IE (<= v 8.0)

ie.png

IE (v 9.0)

ie.png

Google Chrome (>= v 13.* )

gc.png

Firefox (v 6.*)

ff.png

PlaceholderBoxassignednot.gifassignednot.gifassigned.gifassigned.gif
EmailBoxassignednot.gifassignednot.gifassigned.gifassigned.gif
UrlBoxassignednot.gifassignednot.gifassigned.gifassigned.gif
NumberBoxassignednot.gifassignednot.gifassigned.gifassigned.gif
Rangeassignednot.gifassignednot.gifassigned.gifassigned.gif
SearchBoxassignednot.gifassignednot.gifassigned.gifassigned.gif
ColorBoxassignednot.gifassignednot.gifassigned.gifassigned.gif
DateBoxassignednot.gifassignednot.gifassigned.gifassigned.gif
MonthBoxassignednot.gifassignednot.gifassigned.gifassigned.gif
WeekBoxassignednot.gifassignednot.gifassigned.gifassigned.gif
TimeBoxassignednot.gifassignednot.gifassigned.gifassigned.gif
DateTimeBoxassignednot.gifassignednot.gifassigned.gifassigned.gif
DateTimeLocalBoxassignednot.gifassignednot.gifassigned.gifassigned.gif
Progressassignednot.gifassignednot.gifassigned.gifassigned.gif
Meterassignednot.gifassignednot.gifassigned.gifassigned.gif
Audioassignednot.gifassignednot.gifassigned.gifassigned.gif
Videoassignednot.gifassignednot.gifassigned.gifassigned.gif
All Canvas Elementsassignednot.gifassignednot.gifassigned.gifassigned.gif
All SVG Elementsassignednot.gifassignednot.gifassigned.gifassigned.gif

Regarding IE, there is no support for HTML 5 controls in the versions before v9.0. But also some controls are not supported in v9.0. As per one Microsoft website, IE 10.0 will be supporting most HTML 5 controls. I tried to test this in IE 10 Preview platform, but I was not able to test, since it failed to install in my laptop.

Code

ASPX View Engine

ASP.NET
<% Html.Html5().Media.Video("video1", "~/content/mediafiles/video1.webm", 
	"Your browser does not support", new { @width="400px", @height="300px"}); %>

Razor View Engine

HTML
@Html.Html5().Media.Video("video1", "~/content/mediafiles/video1.webm", 
	"Your browser does not support", new { @width="400px", @height="300px"})

Audio and Video

For Audio only MP3 files will be supporting. And video only webm files will be supporting. So you need to convert all types of videos to webm format. You can get many video converter tools online. You can download them and convert the video. Please check the following link:

Sample Screenshots (all in Google Chrome)

scr5.png

scr-audio.png

scr-video.png

scr-canvas.png

scr-svg.png

Developing Application

As we know while creating a ASP.Net MVC 3 Application, in VS 2010, select the respective option and then we will get a another dialog as shown in the below figure. In that, please select "Use HTML5 semantic markup", so that we will get Html5 intellisense in the web pages.

scr1.png

Then we need to add this class library in our ASP.NET MVC application.

scr-se.png

Validation

HTML 5 control client validation as of now you can check in Google chrome and Firefox.

scr_validation.png

Points of Interest

You can download the class library from my previous article: HTML 5 Controls for ASP.NET MVC.

Conclusion

Thanks for viewing this article. I expect feedback from you. You expect more from me.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)