什么是mvc中的html helper类以及它是如何有用的 [英] what is html helper class in mvc and how it is useful

查看:120
本文介绍了什么是mvc中的html helper类以及它是如何有用的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

朋友们,我是MVC的新手。你能告诉我:



1.为什么需要html助手类?

2. Javascript / Jquery不提供相同的功能html助手类提供了什么?

3.使用html助手类的好处?



任何人都可以提供相同的教程链接吗? />


提前致谢:)

Hi friends, I''m new to MVC. Can you tell me:

1. Why html helper class is needed?
2. Javascript/Jquery do not provide the same functionality as html helper class provide?
3. Advantage of using html helper class?

Can anyone provide the tutorial link for the same?

Thanks in advance :)

推荐答案

1)你不需要它们,它们会帮助你输出正确的HTML代码。由于它们是托管代码级别对象,因此您具有智能感知支持,强类型和lambda表达式。主要目标:尽量不要直接编写更少的HTML代码。

2)不,它们服务于完全不同的目的,而帮助程序在服务器端运行时,javascript正在客户端运行。 br />
3)它们可以帮助您以一致,可持续,可维护的方式编写应用程序,并且速度更快。



阅读这些:

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

http://www.asp.net/mvc/tutorials/older-versions/views/creating-custom-html-helpers-cs [ ^ ]
1) You don''t need them, they help you to output proper html code. As they are managed code level objects, you have intellisense support, strong types and lambda expressions. The main goal: not to write as less html code directly as possible.
2) No, they serve totally different purposes, and while the helpers run on server side, javascript is running on client side.
3) They help you to write your application in a consistent, sustainable, maintainable fashion, and also faster.

Read these:
http://stephenwalther.com/archive/2009/03/03/chapter-6-understanding-html-helpers.aspx[^]
http://www.asp.net/mvc/tutorials/older-versions/views/creating-custom-html-helpers-cs[^]


这篇关于什么是mvc中的html helper类以及它是如何有用的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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