title: if else statement in Razor is not functioning
body: <p>I am using an if else in Razor view to check for null value like this:</p>
  
  <pre><code> @foreach (var item in Model)
      {
          &lt;tr id="@(item.ShopListID)"&gt;
              &lt;td class="shoptablename"&gt;@Html.DisplayFor(modelItem =&gt; item.Name)
              &lt;/td&gt;
              &lt;td class="shoptableamount"&gt;
                  @if (item.Amount == null)
                  {
                      Html.Display("--");
                  }
                  else
                  {
                      String.Format("{0:0.##}", item.Amount);
                  }
              &lt;/td&gt;
          &lt;/tr&gt;
  
      }
  </code></pre>
  
  <p>However, no matter my model amount is null or having a value, the html rendered do not contain any value in the amount.</p>
  
  <p>I wonder why this is happening. Any idea?</p>
  
  <p>Thanks...</p>
  
  <p>EDIT:</p>
  
  <p>Decided to did it in controller:</p>
  
  <pre><code>   // Function to return shop list food item amount
      public string GetItemAmount(int fid)
      {
          string output = "";
  
          // Select the item based on shoplistfoodid
          var shopListFood = dbEntities.SHOPLISTFOODs.Single(s =&gt; s.ShopListFoodID == fid);
  
          if (shopListFood.Amount == null)
          {
              output = "--";
          }
          else
          {
              output = String.Format("{0:0.##}", shopListFood.Amount);
          }
          return output;
      }
  </code></pre>
  
  <p>and call at View like:</p>
  
  <pre><code> &lt;td class="shoptableamount"&gt;
                  @Html.Action("GetItemAmount", "Shop", new { fid = item.ShopListFoodID })
              &lt;/td&gt;
  </code></pre>