I work with C# at work but dislike how with webforms it spews out a lot of JavaScript not including the many lines for viewstate that it creates.
我在工作中使用C#,但不喜欢webforms如何喷出很多JavaScript,不包括它创建的viewstate的许多行。
That's why I like coding with PHP as I have full control.
这就是为什么我喜欢用PHP编码,因为我完全可以控制。
But I was just wondering how this sites HTML is so clean and elegant?
但我只是想知道这个网站HTML如何如此干净和优雅?
Does using MVC have something to do with it? I see that JQuery is used but surely you still use asp:required validators? If you do, where is all the hideous code that it normally produces?
使用MVC是否与它有关?我看到使用了JQuery,但你肯定还在使用asp:required validators?如果你这样做,它通常产生的所有可怕代码在哪里?
And if they arent using required field validators, why not? Surely it's quicker to develop in than using JQuery?
如果他们没有使用必要的现场验证器,为什么不呢?当然,开发比使用JQuery更快?
One of the main reasons I code my personal sites in PHP was due to the more elegant HTML that it produces but if I can produce code like this site then I will go full time .net!
我在PHP中编写个人网站的主要原因之一是它产生了更优雅的HTML,但如果我能生成像这个网站的代码,那么我将全天候.net!
9
One of the goals of ASP.NET MVC is to give you control of your markup. However, there have always been choices with ASP.NET which would allow you to generate relatively clean HTML.
ASP.NET MVC的目标之一是让您控制标记。但是,ASP.NET一直有选择,允许您生成相对干净的HTML。
For instance, ASP.NET has always offered a choice with validator controls. Do you value development speed over markup? Use validators. Value markup over development speed? Pick another validation mechanism. Your comments on validators are kind of contradictory there - it's possible to use ASP.NET and still make choices for markup purity over development speed.
例如,ASP.NET总是提供验证器控件的选择。您是否重视开发速度而不是标记?使用验证器。价值加速超过发展速度?选择另一种验证机制。您对验证器的评论在那里是有点矛盾的 - 可以使用ASP.NET并且仍然可以选择标记纯度而不是开发速度。
Also, with webforms, we've had the CSS Friendly Control Adapters for a few years which will modify the controls to render more semantic markup. ASP.NET 3.5 included the ListView, which makes it really easy to write repeater type controls which emit semantic HTML. We used ASP.NET webforms on the Microsoft PDC site and have kept the HTML pretty clean: http://microsoftpdc.com/Agenda/Speakers.aspx - the Viewstate could probably be disabled on most pages, although in reality it's only a few dozen bytes.
此外,使用webforms,我们已经有了几年的CSS友好控制适配器,它将修改控件以呈现更多的语义标记。 ASP.NET 3.5包含了ListView,这使得编写发出语义HTML的转发器类型控件变得非常容易。我们在Microsoft PDC站点上使用了ASP.NET webforms并保持了HTML非常干净:http://microsoftpdc.com/Agenda/Speakers.aspx - Viewstate可能在大多数页面上被禁用,尽管实际上它只是少数几个十几个字节。
3
You were on the right track. It is the fact that they are using the ASP.NET MVC web framework. It allows you to have full control of your output html.
你走在正确的轨道上。事实上,他们正在使用ASP.NET MVC Web框架。它允许您完全控制输出html。
3
The ASP.NET MVC Framework is an alternative to the normal "web forms" way of doing ASP.NET development. With it you lose a lot of abstraction, but gain a lot of control.
ASP.NET MVC框架是执行ASP.NET开发的常规“Web表单”方式的替代方法。有了它你会失去很多抽象,但获得了很多控制权。
2
Yes - MVC doesn't utilize the ASP.NET view state junk.
是的 - MVC不使用ASP.NET视图状态垃圾。
本站翻译的文章,版权归属于本站,未经许可禁止转摘,转摘请注明本文地址:http://www.silva-art.net/blog/2008/08/15/9c5eb31858c9715fec525cbe496614ad.html。