Hi guys plz help me. I have a database with 2 tabels. I want to populate a dropdownlist from each tables in the same view (Create View).
Tables :
Institutions
Persons
MY code to load from Person Table to Create View. I want to load the institution 2, but how can i do it, when i only can send one viewdata to the Create view or whatever.
MY CODE>>>>>>>>>>>
Controller >
public ActionResult Create()
{
var users = db.UserAccounts.ToList().Select(u => new SelectListItem { Text = "CPR > " + u.UserCpr, Value = u.UserCpr.ToString() });
DropdownModel MyModel = new DropdownModel();
MyModel.UserAccounts = new SelectList(users, "Value", "Text");
ViewData.Model = MyModel;
return View();
}
In the Views ...
Go to the complete details ...