title: Passing an optional object to all views
body: <p>So, basically what I'd like is to do something like:</p>
  
  <pre><code>@if(Notification!=null){
       //perform javascript notification with @Notification.Text
   }
  </code></pre>
  
  <p>And I'd like to be able to do this on any view, so I will always have the option of specifying a notification object in my controller action, that, if defined, can be handled in the view.</p>
  
  <p>My dream scenario is to allow this simply by creating the Notification object somehow, and then just returning the view. Meaning, I wouldn't need to explicitly pass the Notification object to the model. Like so:</p>
  
  <pre><code>public ActionResult MyAction(){
      Notification n = new Notification("Text for javascript");
      return View();
  }
  </code></pre>
  
  <p>I'm thinking, that there might be a way to do this with some ViewPage-inheritance? But I'm really unsure of how to go about this?</p>
  
  <p>In an ideal world, I would also love to be able to "override" what to do. For example, if I in my 'top'-layout choose to perform a certain kind of jquery-notification if the notification object exists, but maybe in some other nested view would like to handle it differently, I'd like the option to override the top-layouts handling of the object.</p>
  
  <p>I know this last thing might be a little utopian (I'm just starting out with MVC and Razor), but it would be cool :)</p>