I have an MVC3 C#.Net project. When I initially load my Web site, I want to route to an Index page and have the navigation tabs at the top of the screen be disabled until a selection is made. Once a selection is made, the site routes to a details page. I would then like to enable the navigation menu itmes. How can I do this? Pass a ViewBag around? Not sure
Share
I found an answer to my question. @CodeRush’s answer is cool, which I will use in another scenario. But I like the implementation, below, for my prticular situation. In the Object1Controller Index get Action, I added the below code:
Then in the Details get Action, which is the Action called when a link is clicked on the Index view, I added this code:
Then in the _Layout.cshtml I added this code:
Which renders as:
or
In the other Controllers, I don’t need to set the ViewBag.Hidden property since the default for the visibility attribute is “visible”. For the other Controllers, the ViewSource shows:
Which renders as visible