Hi i want to fill a dropdown list in my view page my code is
public class MemberBasicData
{
public int Id { get; set; }
public string Mem_NA { get; set; }
public string Mem_Occ { get; set; }
}
//controller
public ActionResult Register()
{
var users = new Member().GetAllMembers();
ViewBag.Users = users;
return View();
}
//View
@model IEnumerable<....Members.Models.MemberBasicData>
@Html.DropDownListFor(model => model.Mem_Na, (SelectList)ViewBag.Users, "--Select Users--")
i want to add Mem_NA to dropdownlist, Viewbag contains all the user details. Problem is in View page. An error shows in model.Mem_Na. Please help me to solve this.