tags:

views:

35

answers:

2

So I am trying to figure out a method that can render a error message if my model is null and after that error message the view should stop rendering, is this possible? My first thought was the response.end() method but then the master view won't finish rendering. Is this somthing thats part of the framework our do need to build it myself??

+1  A: 

This logic should really sit in a controller which would choose to render the correct view based on the presence or absence of the model.

This keeps the ASP MVC pipeline in-tact and eliminates the need for view shortcuts.

Ray Vernagus
A: 

Don't see how you model could suddenly be null...

But conceptually sound way to address the situation would be to check the model for null in your controller action and then redirect to an error view.

User