How much logic is allowed in ASP.NET MVC views?

前端 未结 5 835
一生所求
一生所求 2020-12-15 03:49

In looking at samples of ASP.NET MVC sites, I\'m seeing quite a bit of examples with embedded logic in the views, e.g.:

<% if (customerIsAllowed)
   { %&g         


        
5条回答
  •  春和景丽
    2020-12-15 04:16

    As long as the logic in the view is for the presentation (you could put it in the code behind file if you don't like it in the markup file) then it is ok. In your example the code / logic is for selecting a certain view part which is ok. The presentation is allowed to have logic it doesn't need to be simply HTML.

提交回复
热议问题