I have an issue where the selected value is not working for the Html.DropDownList helper method. See below:
This is My Controller:
public ActionResult Ed
First of all, how do you populate ViewBag.NewsItemId.Items
? We don't see where the values come from.
In order to make a selected value work, it must be of the same type as the elements of your collections. If item.NewsItemId
is of type T
, ViewBag.NewsItemId.Items
must be of type IEnumerable
(or any other collection type implementing it). It does not seem to be the case, because you set NewsItemId
as the selected value while your collection is based on NewsItemId.Items
which may not be of the same type.