In editarticle.aspx I have
Code:
<%= Html.DropDownList("categoryID", (IEnumerable<SelectListItem>)ViewData["CategoryID"], new { @class = "textbox" }) %>
and in the ActionResult I have
Code:
ViewData["CategoryID"] = new SelectList(categories, "CategoryID", "Title", article.CategoryID);
which should in the last parameter use the article.CategoryID as it's selected value.
However, when the page loads it's not selecting the correct category.
Is there something wrong with the code?