2009-07-20 14 views
1

私はMVC View User Controlを持っています。コントローラからは、MVC View User Controlが呼び出されたコントローラの名前を知りたいと思います。ascx MVCコントローラは呼び出し元のコントローラを知る必要があります

希望は意味がありますか?

+0

http://stackoverflow.com/questions/1083774/getting-the-name-of-the-controller-and-action-method-in-the-view -in-asp-net-mvcまたはhttp://stackoverflow.com/questions/1116294/better-way-to-find-controller-name-from-masterpage-view-in-asp-net-mvc –

答えて

2

これはそれを行う必要があります。

<%=ViewContext.RouteData.Values["controller"] %> 
関連する問題