开发者

Which is best to use, ViewHelper or Partial View?

I was creating a viewhelper because there is logic on the rendering of the content. But then I realize that I am hardcoding the html inside the vi开发者_StackOverflow中文版ewhelper which is achievable also using the partial view. Many says that views should not have logic in it. But if i used viewhelper, i need to recompile the project if i need to change the style.

So my question is when to use viewhelper and when to use partial view?


You can have logic in partial view, simply it should has short has possible like really simple statement like if/else, it just a best practices to avoid you to code the whole controller work inside the partial views.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜