完全控制呈现的HTML是什么意思?如何实现? [英] What is meant by complete control over rendered HTML? How it can be achieved?

查看:85
本文介绍了完全控制呈现的HTML是什么意思?如何实现?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,专家,
我是Asp.Net MVC的新手.在了解MVC的优点的同时,我研究了我们可以完全控制呈现的HTML.我不知道该怎么做?

请指导我.

在此先感谢.

Hi Experts,
I am new to Asp.Net MVC. While going though the advantages of MVC, i studied that we can have complete control over rendered HTML.I am not able to understand how?

Please guide me.

Thanks in advance.

推荐答案

这意味着与ASP.NET Webforms不同,MVC不会生成垃圾回收控件ID.这使CSS样式和Javascript开发变得容易.此外,它有助于网站的性能. ASP.NET MVC强制更加同步并接近HTML.
没有可以神奇地为您生成标记的转发器,数据网格或此类控件.
没有隐藏的字段可以为您保留状态.

或多或少,它只是您需要使用的HTML.
This means that unlike ASP.NET Webforms, MVC does not generate garbage control ids. This makes CSS styling and Javascript development easy. Further, it helps in performance of a site. ASP.NET MVC forces to be more in sync and close to HTML.
There are no repeaters, datagrids or such controls that magically generate markup for you.
There are no hidden fields to persist state for you.

More or less, it''s just the HTML that you need to work with.


服务器控件将自身呈现为HTML,但不一定是您想要的HTML. MVC通过使用所谓的"HTML帮助器"输出干净的HTML来解决此问题.该框架的另一个好处是,您可以自定义这些帮助程序,以添加自己的自定义控件以呈现所需的任何HTML.

查看下面的文章,以了解有关HTML Helper的更多信息:

http://www.asp.net/mvc/tutorials/old-versions/views/creating-custom-html-helpers-cs [ http://stephenwalther.com/archive/2009/03/03/第6章-understanding-html-helpers.aspx [ ^ ]
Server controls render themselves as HTML, but not necessarily the HTML you want. MVC solves this by outputting clean HTML using what is known as ''HTML helpers''. An added benefit of the framework is, you can customise these helpers to add your own custom controls to render whatever HTML you require.

Look at the articles below to read more about HTML Helper:

http://www.asp.net/mvc/tutorials/older-versions/views/creating-custom-html-helpers-cs[^]

http://stephenwalther.com/archive/2009/03/03/chapter-6-understanding-html-helpers.aspx[^]


看看这个

据我所知

MVC模型的主要优点是明确的关注点分离,单元测试工具以及对URL和HTML的更多控制. MVC模型不使用Viewstate,Postbacks,Server控件和基于服务器的窗体,这些窗体可以完全控制由Views呈现的应用程序和html

谢谢
SP
Look at this

As per my knowledge

The main advantages of the MVC models are clear separation of concerns, unit testing facility, and more control over the URLs and HTML. The MVC model does not use Viewstate, Postbacks, Server controls, and server-based forms that enable full control over the application and html rendered by the Views

Thanks
SP


这篇关于完全控制呈现的HTML是什么意思?如何实现?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆