ASP.Net MVC: Calling a method from a view

前端 未结 8 1160
轻奢々
轻奢々 2020-11-29 02:52

In my MVC app the controller gets the data (model) from an external API (so there is no model class being used) and passes that to the view. The data (model) has a container

相关标签:
8条回答
  • 2020-11-29 03:24

    Controller not supposed to be called from view. That's the whole idea of MVC - clear separation of concerns.

    If you need to call controller from View - you are doing something wrong. Time for refactoring.

    0 讨论(0)
  • 2020-11-29 03:25

    You should create custom helper for just changing string format except using controller call.

    0 讨论(0)
提交回复
热议问题