0
我試圖填充將包含部門名稱的下拉列表。該下拉列表將位於創建新用戶的視圖中。我有兩個單獨的模型,如下所示:從另一個模型填充ASP.NET MVC 5中的下拉列表
public class User : MongoEntity
{
public User()
{
DepartmentName = new List<Department>();
}
public string FullName { get; set; }
public string LoginName { get; set; }
public string Title { get; set; }
public List<Department> DepartmentName { get; set; }
public string TelephoneNumber { get; set; }
public string Email { get; set; }
}
public class Department : MongoEntity
{
public string DepartmentName { get; set; }
public string DepartmentLocation { get; set; }
}
我一直無法將部門模型中的值拉入CreateUser視圖。
我正在爲這個項目使用MongoDB。任何幫助/反饋將不勝感激。
有幾種方法可以做到這一點。看到我的答案在這裏http://stackoverflow.com/questions/18539149/how-to-create-select-list-for-country-and-states-province-in-mvc/18539308#18539308一種方式 – 2015-02-11 19:34:37
你可以發佈您正在使用的代碼嘗試訪問部門? – 2015-02-11 22:53:12