How to best integrate HTML/design with C# code in ASP.Net or ASP.Net MVC? [duplicate]

∥☆過路亽.° 提交于 2020-01-13 06:54:07

问题


We're working on a new ASP.Net site. The last major site we did was in classic ASP--the procedure we used there was to have the HTML completed first, then "bring it to life" with the ASP code.

In the ASP.Net world, how does this work? I.e. how do the designers do their work if much of the mark-up is actually being generated by the server controls?

We are also looking at ASP.Net MVC as a potential lightweight alternative.

Would be very interested to know what was worked best for people in both scenarios in terms of working with the designers and integrating their work with the code.

UPDATE: I refined what I was asking here, not exactly the same question but similar enough so this one could probably be merged with it. Any advice on how to merge them would be appreciated.


回答1:


In my opinion, regardless of how you generate your markup, it's worthwhile to plan that out well. If you merely require the server controls to emit markup that works, you can end up with a significant maintenance burden in terms of keeping your CSS/JS/HTML in order. It's far too easy with ASP.NET webforms and server controls to emit lousy markup.

While I may not code every last bit of HTML for every page I find a clean, well-planned HTML "sketch" can be a helpful starting point for the ASP.NET developers. Get it to the point where the CSS folks can begin applying styles and the ASP.NET devs can develop the functional pieces.




回答2:


Let me answer it from a purely ASP.Net MVC perspective:

  • I will get the designers to still do the HTML design, but at a smaller "view" level rather than a complete page level

  • Then compose pages from the Views with proper valid XHTML, CSS & the works

  • During this composition phase, understand some of the REST-ful features of ASP.Net MVC & see if the UI actions can be properly mapped to REST actions

  • Bring in the developers to start writing ViewModel classes which can be bound to the Views

  • So, while the developers provide the ViewModel classes & mechanism to hydrate them, the designers will be designing HTML views which will be bound to a given ViewModel

HTH.



来源:https://stackoverflow.com/questions/2554658/how-to-best-integrate-html-design-with-c-sharp-code-in-asp-net-or-asp-net-mvc

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!