ASP.NET MVC - Contained User Controls

徘徊边缘 提交于 2019-12-24 01:25:42

问题


I want to be able to create ViewUserControls with their own controllers so all the logic is contained completely. Right now, I have to wire up the ViewUserControls with the main controller and if I wanted to use these viewUserControls elsewhere, I would have to wire them up again. Is it possible to do what I'm hoping for?


回答1:


What you are looking for are subcontrollers. There's been talk they will come in ASP.NET MVC 2 but there is no more news on that yet.

Right now you could check out MVC Contrib project. It has support for subcontrollers.

MvcContrib - now with SubController support for ASP.NET MVC



来源:https://stackoverflow.com/questions/1244911/asp-net-mvc-contained-user-controls

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!