title: Handling null models in partials and null model values
body: <p>i am having problems figuring out how to handle nulls when passing models to partials as well handling null values in models.</p>
  
  <p>In this block:</p>
  
  <pre><code>@section TaskBar{
       @Html.Partial("_TaskBar", Model);
  }
  </code></pre>
  
  <p>I get this error: 
  e:\Views\Shared_TaskBar.cshtml(107): error CS1002: ; expected</p>
  
  <p>???</p>
  
  <p>also, having problem with nulls in the partial</p>
  
  <p>I've tried:
      this.userID = ko.observable("@if(Model.UserID == null){"null"}else{Model.UserID}");</p>
  
  <p>and</p>
  
  <pre><code>this.userID = ko.observable("@(Model.UserID == null)?"null" :Model.UserID");
  </code></pre>
  
  <p>with ; etc... </p>
  
  <p>So my question is.. my partial will often be passed a null model.. so how to handle the partial method and if null how to handle in the view? thanks!</p>