title: Displaying specific Enum Values in a Dropdown in Asp.Net Mvc
body: <p>I have an <code>Enum Class</code> with 4 <code>statuses</code> which are <code>Created</code>, <code>Dispatched</code>, <code>Delivered</code> and <code>Delayed</code> in  that respective order. </p>
  
  <p>Currently, all 4 of these appear in the <code>dropdown</code> on my <code>Edit Delivery page</code>.</p>
  
  <p>What I want is, if my <code>status</code> is <code>Created</code> then I should <strong>ONLY</strong> be able to change it to <code>Dispatched</code>, if my <code>status</code> is <code>Dispatched</code> I should <strong>ONLY</strong> be able to change it to <code>Delivered</code> or <code>Delayed</code>, and if my <code>status</code> is <code>Delayed</code> I should <strong>ONLY</strong> be able to change it to <code>Dispatched</code> or <code>Delivered</code>. </p>
  
  <p>This should all happen on my <code>Edit Delivery page</code>. You'll also notice that I don't want <code>Created</code> in either of the lists above as I only require it in <code>Create Delivery</code>. </p>
  
  <p>So, essentially  I want to achieve is when my <code>delivery status</code> is set to <code>Created</code>, I should only see Dispatched in my Enum Dropdown when I wish to Edit that Delivery. Similarly for Dispatched, if my status is set to dispatched then I only want to see <code>Delivered</code> or <code>Delayed</code>. Same for <code>Delayed</code>, I only want to see <code>Dispatched</code> and <code>Delivered</code>.</p>
  
  <p>I'm fairly new to MVC and if anyone can suggest a solution for this, I'll greatly appreciate it! </p>
  
  <p>Please let me know if any additional code is required and I will add it to the question. </p>
  
  <p>Enum Class:</p>
  
  <pre><code>public enum Status
  {
      Created, Dispatched, Delivered, Delayed
  }
  </code></pre>
  
  <p>Delivery View Model:</p>
  
  <pre><code>public class DeliveryVM
  {
      public int? ID { get; set; }
      public Status Status { get; set; }
  }
  </code></pre>
  
  <p>Delivery Edit View:</p>
  
  <pre><code>        &lt;div class="form-group"&gt;
              @Html.LabelFor(model =&gt; model.Status, htmlAttributes: new { @class = "control-label col-md-2" })
              &lt;div class="col-md-10"&gt;
                  @Html.EnumDropDownListFor(model =&gt; model.Status, htmlAttributes: new { @class = "form-control", @id="dropdown" })
                  @Html.ValidationMessageFor(model =&gt; model.Status, "", new { @class = "text-danger" })
              &lt;/div&gt;
          &lt;/div&gt;
  </code></pre>