Look Up Controller Action in View

Topics: General
Oct 7, 2011 at 5:13 PM

I want to conditionally exclude the login and dashboad links from a few pages in the layout.cshtml file but I'm not sure how to reference the controller action to bypass the WorkContext.  

I've looked around for ViewContext, RouteData, filterContext, ActionDescriptor, ActionName with no luck.  Or is there a better way to do this maybe?

As always, the help is greatly appreciated!

Coordinator
Oct 7, 2011 at 6:01 PM

The simplest is probably to just surround the addition of the User shape with the condition you need. Why do you need to reference the controller action and bypass the workcontext?

Oct 7, 2011 at 6:12 PM

The account team doesn't want to see the 'Sign In' link on the Log In and Forgot Password screens (I stopped asking why to requests like this from them).  I figured wrapping the WorkContext.Layout.Header.Add(New.User(), "10"); in an if would be the easiest thing to do without causing problems.

Coordinator
Oct 7, 2011 at 6:28 PM

Sure. So why do you need to reference the controller action and bypass the workcontext for that?

Oct 11, 2011 at 12:56 AM

You're right. I was drinking the Kool-aid.  Sorry about that.