title: How to show message if dropdown list gets null in mvc?
body: <p>I have a drop down list that i fill dynamically from database. I want to show message to user if list get null(Database has no value). If database has value list should show "Select" that i have done. How can i show message "No value to select" if list gets null?
  This is my drop down</p>
  
  <pre><code> @Html.DropDownListFor(model =&gt; model.ProductId, new SelectList(Model.ProductTypes, "ProductId", "ProductType"), string.Concat("-- ", "Select", " --"), new { Class = "form-control" })
  </code></pre>
  
  <p>I try this in case of null but does not work fine.</p>
  
  <pre><code>@Html.DropDownListFor(model =&gt; model.ProductId, new SelectList(Model.ProductTypes, "ProductId", "ProductType"), @Model.ProductTypes==null?string.Concat("-- ", "No value to select", " --"): string.Concat("-- ", "Select", " --"), new { Class = "form-control" })
  </code></pre>