tags:

views:

121

answers:

2

I have a shared master view for all my other views. It's in this master view I show the menu. Now I need to find out in what controller I'm currently in so I can disable/enable certain menu options.

For example it should be possible to press the "foo" link if I'm current in the "foo" controller.

How Can I do this?

+8  A: 

You can find it with the viewcontext

CD
Think ViewContext should hold this info.
Damien
+7  A: 

Could you use?

<%=Html.ViewContext.RouteData.GetRequiredString("controller") %>

Kindness,

Dan

Daniel Elliott