admin管理员组文章数量:1325222
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 overe 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 remendations for .NET coding practices, libraries, etc. which might would be really helpful.
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 overe 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 remendations for .NET coding practices, libraries, etc. which might would be really helpful.
Share Improve this question edited Jun 25, 2017 at 10:01 ɢʀᴜɴᴛ 32.9k15 gold badges121 silver badges114 bronze badges asked Sep 11, 2008 at 13:02 markedupmarkedup 1,2572 gold badges12 silver badges22 bronze badges4 Answers
Reset to default 5The 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.
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./Blog/archive/2007/11/28/testing-scottgu-alternate-view-engines-with-asp-mvc-nvelocity.aspx
As the view engine is responsible for creating HTML what es out depends on your choice. But most view engines are better in this respect than vanilla ASP.Net
@Wrestlevania said:
any remendations for .NET coding practices, libraries, etc. which might would be really helpful.
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.
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.
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.
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.
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.
本文标签: javascriptWill NET MVC give me the HTMLCSSJS separation I needStack Overflow
版权声明:本文标题:javascript - Will .NET MVC give me the HTMLCSSJS separation I need? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742172446a2426963.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论