0
我有一個名爲產品的集合,它有兩個字段Id和Name。Dropdownlist viewdata?
有關創建下拉列表中,我使用
ViewData["Geography"] = new SelectList(parent,"Id","Id");
我想在下拉列表中顯示編號+姓名。
我嘗試以下事情,因此未從parentCollection
工作
ViewData["Geography"] = new SelectList(parentCollection,"Id","Id Name");
ViewData["Geography"] = new SelectList(parentCollection,"Id","Id" + "Name");