简体   繁体   中英

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM