为什么要使用HTML帮助中的ASP.NET MVC? [英] Why do we use HTML helper in ASP.NET MVC?

查看:128
本文介绍了为什么要使用HTML帮助中的ASP.NET MVC?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有一个ASP.NET MVC项目中使用的HTML帮助后,任何好东西,最好的做法或利润,我们有吗?

Are there any good thing, best practice or profit we have after using the HTML helper in an ASP.NET MVC project?

当我试图利用他们,我发现我失去了我与HTML的速度和许多困难我,每当我使用HTML帮手。

When I am trying to use them I found that I lose the speed I have with HTML and many difficulties I have whenever I use an HTML helper.

其他[非技术人员]人不明白我写的使用助手,如果我想告诉他们或者他们想要做的,他们需要花更多的时间,即使他们有工作的HTML知识的东西。

Other [non-techie] persons can't understand what I write using Helper if I want to show them or they want to do something they need to spent more time on, even if they have working knowledge of HTML.

如果我使用HTML帮助我失去了速度。当我使用HTML我只需键入,当然我没有意识到这一点。但是,使用帮手,这是很难理解的。

If I use an HTML helper I lose the speed. When I use HTML I just type and of course I am not aware of it. But using helper, it is hard to understand.

我们得到什么东西,当我使用的HTML帮助?我认为这是什么,我得到,因为我失去了speeed。其他人无法理解我使用的是什么帮助,如果他们想不能自定义code。

What thing do we get when I use HTML helper? I think it is nothing I get because I lose the speeed. Others can't understand what I do using helper and can't customize the code if they want.

为什么我们使用HTML佣工?

Why do we use HTML helpers?

推荐答案

您使用HTML佣工来封装这些重复在你的网页一些小的HTML片段。并避免那些编写HTML片段一遍你用助手。

You use HTML helpers to encapsulate some small HTML fragments which are repeated all over your pages. And to avoid writing those HTML snippets all over again you use helpers.

他们是非常有用的,尤其是与事情打交道一样,因为不是硬编码的链接的助手把你的服务器上的路由定义通过简单地改变这些路由整个网站的网址的变化而没有触及任何一个HTML页面,并利用URL时。

They are very useful, especially when dealing with things like URLs because instead of hardcoding your links helpers take advantage of routing the definition on your server and by simply changing those routes the whole site URLs' change without ever touching any single HTML page.

在哪里HTML助手是有用的另一种情况是,用来生成表单输入字段。在这种情况下,他们回发时,并显示相关的验证消息自动可以处理的值。你能想象的意大利面条code,你会在你的看法写,如果有不HTML佣工?

Another scenario where HTML helpers are useful is for generating form input fields. In this case they automatically could handle values when posting back and show associated validation messages. Can you imagine the spaghetti code you would have to write in your views if there weren't HTML helpers?

这篇关于为什么要使用HTML帮助中的ASP.NET MVC?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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