[英]Should I write action methods of the partial view in the controller of the parent view?
After I render a partial view in the view, I wonder what the controller of the partial view is for now? 在视图中渲染局部视图后,我想知道现在局部视图的控制器是什么?
I don't need it anymore? 我不再需要了吗?
Partial Views shouldn't have separate controllers. 部分视图不应具有单独的控制器。 you should place partial view in parents view folder.
您应该将部分视图放在“父视图”文件夹中。
We can decide this on the basis of their functionality. 我们可以根据其功能来决定。 As if your partial view is only meant to be used in your current parent view or it has relevant functionality to the parent view, so in this case we don't need to add a new controller for the partial view.
好像您的部分视图仅打算在当前父视图中使用,或者它具有与父视图相关的功能,因此在这种情况下,我们不需要为部分视图添加新的控制器。 But, if your partial view is going to be used by some other parent views also or it has some common functionality between other controllers also, then we need put this partial in separate controller.
但是,如果您的局部视图也将被其他一些父视图使用,或者它在其他控制器之间也具有某些通用功能,那么我们需要将此局部视图放在单独的控制器中。 @Taichi, this is what i think, decision will be always yours.
@Taichi,这就是我的想法,决定永远是你的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.