<p>I'm working with my ASP.NET development team to try and create "better" <em>(i.e. cleaner)</em> 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.</p>

<p>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. <em>(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.)</em></p>

<p>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?</p>

<p>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.</p>

[{'answer_id': 56485, 'author': 'Mendelt', 'author_id': 3320, 'author_profile': 'https://Stackoverflow.com/users/3320', 'pm_score': 2, 'selected': False, 'text': '<p>Depending on the view engine you\'re going to use. yes.</p>\n\n<p>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.</p>\n\n<p>Some more clarification:</p>\n\n<p>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.\n<a href="http://www.chadmyers.com/Blog/archive/2007/11/28/testing-scottgu-alternate-view-engines-with-asp.net-mvc-nvelocity.aspx" rel="nofollow noreferrer">http://www.chadmyers.com/Blog/archive/2007/11/28/testing-scottgu-alternate-view-engines-with-asp.net-mvc-nvelocity.aspx</a></p>\n\n<p>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</p>\n'}, {'answer_id': 56489, 'author': 'Ryan Lanciaux', 'author_id': 1385358, 'author_profile': 'https://Stackoverflow.com/users/1385358', 'pm_score': 4, 'selected': True, 'text': "<p>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.</p>\n\n<p>You can, for the most part, separate HTML / CSS / JS like you would in a different framework.</p>\n"}, {'answer_id': 56592, 'author': 'Geoff', 'author_id': 1097, 'author_profile': 'https://Stackoverflow.com/users/1097', 'pm_score': 1, 'selected': False, 'text': '<p>@Wrestlevania said:</p>\n\n<blockquote>\n  <p>any recommendations for .NET coding\n  practices, libraries, etc. which might\n  would be really helpful.</p>\n</blockquote>\n\n<p>I try to maintain a high level of separation while coding in ASP.Net.  I find that if I avoid the asp controls and stick as much as possible with basic html elements, I can avoid any situation where ASP.Net would be inclined to inject extra CSS or JS into my page.  Example, use span in place of asp:literal, button in place of asp:button, etc.</p>\n\n<p>The only ASP control I use is the repeater, which is used to create a table.  Any functionality I need that would be similar to an asp control, I either implement myself in javascript, or use a framework like jquery.</p>\n'}, {'answer_id': 58423, 'author': 'loudej', 'author_id': 6056, 'author_profile': 'https://Stackoverflow.com/users/6056', 'pm_score': 0, 'selected': False, 'text': "<p>Asp.Net MVC will help you keep html/css/js separate in that it will present fewer features that would prevent you from keeping them separate.</p>\n\n<p>For example Html helpers typically return just that: Html. From that point you are free to choose to keep all style information associated only by class attributes. </p>\n\n<p>Consider also looking into the practices you usually follow with a library like jQuery. It's an excellent example of how to keep the scripted functionality entirely in your js and out of your html by applying the event handling behaviors to the elements on page load based on things like element type, class and id.</p>\n"}]
['https://Stackoverflow.com/questions/56479', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/3212/']