tags:

views:

105

answers:

1

I have an if/else statement in the controller and 2 different types of views to display depending on the outcome.

So I have my 2 views in a .aspx page with a placeholder around each.

How do I set the property placeholder.Visible from the controller? Or by the theory of MVC should I even be doing that sort of presentation in the controller? It sounds like I would be blurring the seperation of front-end output.

+1  A: 

Don't do that.. just have two aspx pages/views. Don't worry about placeholders.

To elaborate, yes, you can do that kind of logic in an action method. And yes, you can have an action method render a view conditionally. This is normal!

If the logic in the action gets to be so much that you have difficulty maintaining the unit test, refactor

Matt Hinze