MVC Display object value in dropdownlist in edit view of object collection
<p>I have some problem in communicating data from controller to view and vise-versa. Here is my controller:</p>

<pre><code>ViewBag.MANAGER_IDS = new SelectList(db.APP_USERS, "USER_ID", "USER_ID");
return View(app_users_manager);
</code></pre>

<p>What I want to do is to populate populate manager ids in a dropdownlist for each object (i.e. app_users_manager)</p>

<p>Following is my view:</p>

<pre><code>@model List&lt;HRM.Models.APP_USERS_MANAGER&gt;
@{
    ViewBag.Title = "Edit managers";
}
@using (Html.BeginForm("Edit", "UserManager", FormMethod.Post)) {
    @Html.AntiForgeryToken()

    &lt;table&gt;
        &lt;tr class="myidtr"&gt;
            &lt;th&gt;Manager role&lt;/th&gt;
            &lt;th&gt;Manager&lt;/th&gt;
        &lt;/tr&gt;
        @for (int i = 0; i &lt; Model.Count; i++)
        {
            &lt;tr class="mytr"&gt;
                @Html.Hidden("app_users_manager[" + @i + "].USER_ID", Model[i].USER_ID)
                &lt;td&gt;
                    @Html.DisplayFor(modelItem =&gt; Model[i].APP_MANAGERS.MANAGER_DESCRIPTION)
                &lt;/td&gt;
                &lt;td&gt;
                    @Html.DropDownList("app_users_manager[" + @i + "].USER_ID_MANAGER", ViewBag.USER_ID_MANAGER as List&lt;SelectListItem&gt;, "-Select manager-")
                &lt;/td&gt;
            &lt;/tr&gt;
        }
    &lt;/table&gt;

    @Html.ValidationSummary(false)
    &lt;p&gt;
        &lt;input type="submit" value="Save" /&gt;
    &lt;/p&gt;
}
</code></pre>

<p>I am able to do so using the following:</p>

<pre><code>@Html.DropDownList(Model[i].USER_ID_MANAGER, ViewBag.USER_ID_MANAGER as List&lt;SelectListItem&gt;, "-Select manager-", new { @Id = "Test"})
</code></pre>

<p>but then I do not get updated value in my controller. or if I do following then I am not be able to get value on the view:</p>

<pre><code>@Html.DropDownList("USER_ID_MANAGER", ViewBag.USER_ID_MANAGER as List&lt;SelectListItem&gt;, "-Select manager-")
</code></pre>

<p>Can somebody suggest whats wrong in there? Any help is very much appreciated!!</p>