How to display dynamic dropdownlists in Edit view with selected values in .NET MVC?
<p>I have a form, which includes three dynamic dropdownlists. They are all one-to-many relationships. The first dropdownlist has loaded values and the other two are empty at the start. When user selects one value from the 1st dropdownlist, the 2nd dropdownlist will load corresponding items; when user selects a value from the 2nd dropdownlist, the 3rd dropdownlist will load relating items.</p>

<p>User can create the form and submit. My CreateController GET and POST methods works well.</p>

<p>Now I need EditController to allow user to edit his form. The problem is how to display the 2nd and the 3rd dynamic dropdownlist with selected values?</p>

<p>In my viewModel:</p>

<pre><code>    public Nullable&lt;int&gt; Tech_ID { get; set; }
    public string TechniqueName { get; set; }
    public SelectList Techniques { get; set; }

    public Nullable&lt;int&gt; BU_ID { get; set; }
    public string BuName { get; set; }
    public SelectList BusinessUnits { get; set; }
</code></pre>

<p>In my Edit Controller:</p>

<pre><code>ViewBag.Bulist = new SelectList(AllBus, "BU_ID", "BU_Title", form.BU_ID); 

var butechList = GetTechList(Convert.ToInt32(form.BU_ID));
IEnumerable&lt;SelectListItem&gt; butechs = butechList.Select(m =&gt; new SelectListItem()
{
    Value = m.Tech_ID.ToString(),
    Text = m.Technique.Tech_Title
});
ViewBag.Techlist = new SelectList(butechs, "Tech_ID", "Tech_Title", form.Tech_ID);
</code></pre>

<p>in View page:</p>

<pre><code>@Html.DropDownListFor(model =&gt; model.BU_ID, 
    new SelectList((IEnumerable&lt;SelectListItem&gt;)@ViewBag.Bulist, "Value", "Text", Model.BU_ID), 
    new { id = "ddlBU" })

@Html.DropDownListFor(model =&gt; model.Tech_ID, 
    new SelectList((IEnumerable&lt;SelectListItem&gt;)@ViewBag.Techlist, "Value", "Text", Model.Tech_ID), 
    new { id = "ddlTechs" })
</code></pre>

<p>The first dropdownlist is working correctly, but the second is not.</p>