Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Will .NET MVC give me the HTML/CSS/JS separation I need?

I'm working with my ASP.NET development team to try and create "better" (i.e. cleaner) HTML when rendering pages. At the moment, .NET has a nasty tendency to do things like dump JavaScript into the page, making it a mandatory requirement on form controls and not allowing forms to work when JS isn't available. In some instances, we're struggling to overcome this without having to add a notable chunk to development time estimates.

I've worked with MVC before - via Struts in Java - and found that in that instance, I was able to keep HTML pages exactly as I'd wanted them to be. (This viewpoint is based on the "best case" static HTML I typically developed beforehand, then handed over to the Java programmers to fill in the holes.)

This worked out really well and we were able to produce some of the "best" web pages from a CMS that I've seen. Could .NET MVC give me the separation I need, or would it be a false economy to put aside valuable development time to test this?

If .NET MVC isn't going to give me this fine-grained control over separation, any recommendations for .NET coding practices, libraries, etc. which might would be really helpful.

like image 601
markedup Avatar asked Sep 11 '08 13:09

markedup


People also ask

Does .NET use HTML and CSS?

ASP.NET is a free web framework for building great websites and web applications using HTML, CSS, and JavaScript.

Should I put CSS in separate file?

Separating css styles in separate files make the cachable. So, it affects the page load time too (also decrease the more page load times by minifying the css). Readability: huge HTML files are a bad sign itself.

Why might it be preferable to store CSS in a separate file rather than including it inside your .HTML files?

CSS and HTML are best kept separate so that the CSS is uniformly accessible to all pages on a site, not just the document it is included in. Integrating CSS into webpages is an inefficient way to style a site.

Do you need to know HTML for ASP NET?

It is a development mindset and languages that you have to know in order to be "a . NET developer". Although it can be used for desktop applications, . NET is heavily used for web development; in that case you do need to know HTML, CSS and a few other things to complete any project.


2 Answers

The ASP.NET MVC Framework would give you a much more familiar separation. Because there is no viewstate, etc in the MVC Framework you won't have to worry about JavaScript being dumped into your pages. The only JavaScript calls you see will be ones that you manually add.

You can, for the most part, separate HTML / CSS / JS like you would in a different framework.

like image 96
Ryan Lanciaux Avatar answered Nov 04 '22 16:11

Ryan Lanciaux


Depending on the view engine you're going to use. yes.

But you can easilly check this by looking at the page-source for stack-overflow. It's not zen-garden but it's pretty clean.

Some more clarification:

The rendering of the pages is done by the view engine. You can use the standard view engine or existing ones like nVelocity or Brail, just like with monorail. http://www.chadmyers.com/Blog/archive/2007/11/28/testing-scottgu-alternate-view-engines-with-asp.net-mvc-nvelocity.aspx

As the view engine is responsible for creating HTML what comes out depends on your choice. But most view engines are better in this respect than vanilla ASP.Net

like image 28
Mendelt Avatar answered Nov 04 '22 14:11

Mendelt