本文介绍了的HtmlHelper扩展方法VS局部视图?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我好奇时,它的推荐使用的HtmlHelper扩展方法,以及何时使用局部视图?他们似乎在许多情况下同等资格。

I curious when it's recommended to use HtmlHelper extension method and when to use partial view? They seem to be equally eligible in many cases.

推荐答案

我个人认为,局部视图或多或少类似的在asp.net中,它作为一个可重用的群功能元件为用户控件。例如,如果你需要,可能会在整个网站上显示的登录控制箱,局部视图效果会更好。更重要的是局部视图,它实际上是自包含自己的渲染/加工策略(并可能有自己的状态为好)

I personally think that partial view is more or less similar to usercontrol in asp.net, which act as a group of reusable functional elements. For example, if you need to make a login control box that may appear across the whole site, partial view would be better. What's more for partial view is, it is actually self-contained with its own rendering/processing strategy (and may have its own state as well)

在另一方面,是的HtmlHelper工具只是用于保存编码时间和维护,在某种程度上有更好的可读性上的codeS。

On the other hand, htmlhelper is just tools for saving coding time and maintain, somehow better readability on your codes.

这篇关于的HtmlHelper扩展方法VS局部视图?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-25 20:33