开发者

ASP.NET MVC3 List all areas

开发者 https://www.devze.com 2023-03-18 22:38 出处:网络
I have an ASP.NET MVC3 application in which I am creating multiple areas, is there a way I can find out programmatically the number of areas that are present and their names.

I have an ASP.NET MVC3 application in which I am creating multiple areas, is there a way I can find out programmatically the number of areas that are present and their names. What I want to do it create some partial pages in the different areas and in开发者_运维技巧 the main application create a page that will render the partial pages.


Is there a way I can find out programmatically the number of areas that are present and their names

No AFAIK currently there isn't an easy and reliable way to do this. In ASP.NET MVC 4.0 though there will be, I promise :-)

Currently you might need to use reflection and look at all namespaces containing Areas.something and count them. Not very reliable.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号