I do:
@Html.DropDownList("ddBrand", (IEnumerable<SelectListItem>)ViewBag.Brands, new {onchange = "JavaScript:Act()"})
But when I press submit it needs the field “ddBrand” in View Model.
How can I add DropDownList to View without binding to ViewData? (without adding field “ddBrand” in View Model)
Simply generate the HTML. You can create the
options in a for loop. You can give different name to theidandnameattributes.